BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5

data l;
input dt $ 1-20;
dt1=input(dt,ddmmyy10.);
format dt1 ddmmyy10.;
cards;
13/01/2011
12/02/2009
15/02/2009
run;
proc print;
run;

proc sql;
select max(dt1)into :max_dt from l;
quit;

The macro variables max_dt is resoving to 18640 but i want to get the date format like this 3/01/2011
as i want to add this macro variable to the output file with the date if it is showing as 18640
it is problem for me or it can show as 03_jan_2011

3 REPLIES 3
LinusH
Tourmaline | Level 20

You have to explicitly specify the format with into: clause:

select max(dt1) format=ddmmyy10. into: max_dt from l;

/Linus

Data never sleeps
milts
Pyrite | Level 9

Hi,

LinusH's example is correct. You might want to check your table again.

R_Win
Calcite | Level 5

Thqs Linus it worked

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
  • 3 replies
  • 789 views
  • 0 likes
  • 3 in conversation