I need help concatenating my two dates to a comment field. Here's what I have
DATA PRX;
SET BICS_02;
format prx_startdt prx_enddt mmddyy10.; /*format to mm/dd/yyyy*/
prx_startdt = datepart(Optional_1_start_date); /*optional date is date and time*/
prx_enddt = datepart(Optional_1_end_date); /*optional date is date and time*/
period_comments = prx_startdt||" to "||prx_enddt; /*combine the dates in comment "start date to end date"*/
run;
prx_startdt and prx_enddt just post the date values. I have converted it to the right format but in the doesn't translate correctly to my comments field. Please help.
Try it this way:
period_comments = put(prx_startdt, mmddyy10.) || " to " || put(prx_enddt, mmddyy10.);
Since the variable already has a format, this works too:
PERIOD_COMMENTS = vvalue(PRX_STARTDT) || ' to ' || vvalue(PRX_ENDDT);
Thanks a lot, it works!!
Thank you, it works!
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 save with the early bird rate—just $795!
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.