The string variable is called start_date and is in the form of "SEP22", "JAN23", "MAY22" etc.
I want to convert this to a date variable in the form of "01SEP2022", "01JAN2023", "01MAY2022". How do I do this?
CodePudding user response:
- Use the
input
function with the right informat to convert it to a SAS datetime. - Apply the desired format
data want;
string = 'SEP22';
date = input(string, monyy.);
format date date9.;
run;
string date
SEP22 01SEP2022