Hi Folks:
I'm baffled that seemingly correct solution to convert character date to numeric date doesn't work. According to the SAS Viewtable I'm using correct format YYMMDD10. in the code below. However, the code below outputs missing Date1 variable. What am I doing wrong here, any idea?
data time1; set time;
Date1=input(date,YYMMDD10.);
run;
The variable DATE is already a a date.
You don't need to convert it.
You can change its associated format to display it differently.
INPUT works is to read a CHARACTER value for the first parameter using the informat specified in the second parameter.
Your Date is already numeric. So input isn't correct to use.
If you want to convert numeric to character then use PUT.
date1 = put(date,yymmdd10.);
or other format.
The variable DATE is already a a date.
You don't need to convert it.
You can change its associated format to display it differently.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.