BookmarkSubscribeRSS Feed
LNM
Fluorite | Level 6 LNM
Fluorite | Level 6

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.

4 REPLIES 4
Astounding
PROC Star

Try it this way:

 

period_comments = put(prx_startdt, mmddyy10.) || " to " || put(prx_enddt, mmddyy10.); 

 

 

ChrisNZ
Tourmaline | Level 20

Since the variable already has a format, this works too:

 

PERIOD_COMMENTS = vvalue(PRX_STARTDT) || ' to ' || vvalue(PRX_ENDDT); 

 

LNM
Fluorite | Level 6 LNM
Fluorite | Level 6

Thanks a lot, it works!!

LNM
Fluorite | Level 6 LNM
Fluorite | Level 6

Thank you, it works!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3926 views
  • 0 likes
  • 3 in conversation