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;
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.