data have;
infile cards ;
input ID $Date1 ;
cards;
001 200404
002 201205
003 200903
;
run;
I have a data with date variable entered into a character format. Would it be possible to: 1) assign all dates a day of "01" and 2) convert the variable to SAS date
Output
001 04012004
002 05012012
003 03012009
;
Yes, of course, something like
data want;
set have(rename=(Date1 = DateStr));
Date = input(cats(DateStr, '01'), yymmdd8.);
format Date mmddyy8.;
run;
Yes, of course, something like
data want;
set have(rename=(Date1 = DateStr));
Date = input(cats(DateStr, '01'), yymmdd8.);
format Date mmddyy8.;
run;
Super! thank you!
data want;
set have;
sasdt=input(cats(date1,'01'),yymmdd8.);
format sasdt mmddyyn8.;
run;
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.