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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1318 views
  • 0 likes
  • 4 in conversation