I have a char date that is formatted mm/dd/yyyy, I need to keep the date in a char format and change it to be a mm/dd/yy. Any assistance is appreciated. Thanks
data want;
set have;
want=cats(substr(char_date,1,6),substr(char_date,9));
run;
You can do something like this
data test;
chardate='03/04/2019';
newchardate=put(input(chardate, mmddyy10.), mmddyy8.);
run;
data have;
do date=today()-7 to today();
char_date=put(date,mmddyy10.);
output;
end;
drop date;
run;
data want;
set have;
substr(char_date,7,2)=' ';
char_date=compress(char_date);
run;
data want;
set have;
want=cats(substr(char_date,1,6),substr(char_date,9));
run;
Perfect! Thanks so much!!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.