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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.