I have visit_date that shows like this
20190321
20190216
20190516 this is in numeric best 12 format
I would like it to be like this
2019/03/21
2019/02/16
2019/05/16
i did
data want;
data have;
format visit_date mmddyy10.;
run;
it did not work. Help me please.
data have;
input date ;
want=input(put(date,best. -l),yymmdd10.);
format want yymmdds10.;
cards;
20190321
20190216
20190516
;
run;
Use format yymmdds10.;
format visit_date yymmdds10.;
If those are just numbers, you may need some conversion
data have;
input date;
cards;
20190321
20190216
;
data want;
set have;
cdate=put(date,8. -l);
want_date=input(cdate,yymmdd8.);
format want_date yymmdds10.;
run;
SAS date formats is how you take care of that. Here is a link to those formats.
self-service is always welcome
data have;
input visit_date yymmdd8.;
cards;
20190321
20190216
20190516
;
data want;
set have;
visit_date_newview = visit_date;
format visit_date_newview yymmdds10.;
run;
data have;
input date ;
want=input(put(date,best. -l),yymmdd10.);
format want yymmdds10.;
cards;
20190321
20190216
20190516
;
run;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.