Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SAS dates

Status
Not open for further replies.

Filipvdr

Programmer
Mar 11, 2010
25
0
0
BE
Hello, i'm a SAS beginner and i have a question:

i'm trying to archive a part of my dataset

data _null_;
format archive_date date9.;
archive_date = date() - (30);
put 'Archief_datum = ' archive_date;
call symput('archive_date',left(put(archive_date,12.)));
run;

data rf300l3.W_status_foup_count;
set rf300l3.W_status_foup_count;
if Date > &archive_date then output rf300l3.W_status_foup_count;
run;

yet, i get this error:


NOTE: Character values have been converted to numeric values at the places given by:
(Line):(Column).
1082:5
NOTE: Invalid numeric data, date='28OCT2010' , at line 1082 column 5.
dept=BIONE date=28OCT2010 code=HOLD CUST nbr=0 _ERROR_=1 _N_=1
NOTE: Invalid numeric data, date='28OCT2010' , at line 1082 column 5.

any help?

thanks
 
What format is your "date" variable in rf300l3.w_status_foup_count??
 
But is it stored as a character field rather than a date field? Your error suggests that 01JAN2009 for example is a character field which it's then trying to change to a numeric to carry out the numeric date comparison on and it's causing an error. SAS dates work by linking a date to the number of days before and after 1st Jan 1960 (I think!) and therefore to check if something is before or after a certain date or number of days it needs to be reading it as a date fields rather than character.


If it's a character - try turning it to a date field first maybe? If not...we'll try something else!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top