BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I have DATE as character variable (length 9) in the dataset "now_char" and the DATE column has dates like :- 22JAN2010 . I use the code:--


data combine;
set now_char;
if DATE LT "07JAN2010" THEN
Week = "Week1";
ELSE IF DATE GT "07/01/08" AND DATE <="15/01Jan/08" THEN
Week = "Week2";
RUN;

Log:-

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
760:16 762:21 762:43
NOTE: Invalid numeric data, '27JAN2008' , at line 760 column 16.
NOTE: Invalid numeric data, '26/01/08' , at line 762 column 21.
NOTE: Invalid numeric data, '31/01Jan/08' , at line 762 column 43.

Any suggestions?

Kindest Regards,
Kriti
1 REPLY 1
Robert_Bardos
Fluorite | Level 6
When comparing date values then use numeric values/variables. So you will have to transform the variable to e.g. date_num. As for the date constants look up - well - "date constants" in the online documentation.
Suggested search terms: input function, date constants.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 612 views
  • 0 likes
  • 2 in conversation