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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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