Hi. I currently have a dataset that contains date9. columns.
I want to convert it to yymmn6. in character. Is it do-able?
data date;
input dates 8.;
datalines;
01/02/2012
run;
i want it to be:
201202 in character.
data test;
date="05dec2018"d;
format date date9.;
charDate=put(date, yymmn6.);
run;
data test;
date="05dec2018"d;
format date date9.;
charDate=put(date, yymmn6.);
run;
data have;
input dates :ddmmyy10.;
yymmn=put(dates,yymmn6.);
datalines;
01/02/2012
run;
Your data step creates missing values. Please test example data code before posting it here.
I guess you meant to do
data date;
input dates ddmmyy10.;
format dates date9.;
datalines;
01/02/2012
;
run;
From there you can apply the other's suggestion.
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.