BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I need to create a monthly report. For that i have created a macros,

data _null_;
call symput ('begindt',intnx('MONTH',today(),-4));
call symput ('enddt',intnx('MONTH',today(),-3));
call symput ('rdate',put(today(),date9.));
run;

If run this code , %put &begindt ; am getting SAS date.
If i want to see in ddmmyyyy means how to convert the code ?

Pls anyone let me know..

Thanks,
sudha
5 REPLIES 5
ArtC
Rhodochrosite | Level 12
Use %SYSFUNC with the PUTN function.
[pre]
%let begindt = 18234;
%put %sysfunc(putn(&begindt,ddmmyy10.));[/pre]
deleted_user
Not applicable
Hi ,

Thanks for your reply...
But if i ran that syntax

%put %sysfunc(putn(&begindt,ddmmyy10.));

am getting an output as 01/01/1960..

But i need to get an output as 09/01/2010.

please let me know..

Thanks,
sudha
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Sudcha,

I tried ArtC's suggestion on my computer. This code works as expected:
[pre]
data _null_;
call symput ('begindt',intnx('MONTH',today(),-4));
run;
%put begindt=%trim(&begindt);
%put %sysfunc(putn(&begindt,ddmmyy10.));
[/pre]
Sincerely,
SPR
deleted_user
Not applicable
Yes am getting an exact output what am expecting !!

Thank you !!!
PatrickG
SAS Employee
You can find out more about using SAS dates here. I hope this helps.

http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm

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
  • 5 replies
  • 791 views
  • 0 likes
  • 4 in conversation