Hi Sir,
I need Complete Current month days list,whenever its running it should list only Current month Complete days.
i tried this code but i'm not getting
%LET DATE=%SYSFUNC(TODAY(),DATE9.);
%PUT &DATE;
%LET BugnMon = %SYSFUNC(INTNX(MONTH,%SYSFUNC(TODAY()),0,B),Date9.);
%PUT &BugnMon;
%LET EndMon = %SYSFUNC(INTNX(MONTH,%SYSFUNC(TODAY()),0,E),Date9.);
%PUT &EndMon;
OR
%LET start_date=(intnx('month',today(),0,'B'),DATE9.);
%PUT &start_date;
%LET end_date=(intnx('month',today(),0,'E'),DATE9.);
%PUT &end_date;
%let start_date= &start_date;
%let end_date=&end_date;
Like Current month is APR and Today is 17APR2019 .Output should list from 1APR2019 to 30APR2019
Can any one help on this.
Thanks,
Siva
Use data step logic like below and work from there.
data test(keep=date);
firstday=intnx('month', today(), 0, 'b');
lastday=intnx('month', today(), 0, 'e');
do date=firstday to lastday;
output;
end;
format date date9.;
run;
HI @sivastat08
Your
%LET start_date=(intnx('month',today(),0,'B'),DATE9.);
%PUT &start_date;
%LET end_date=(intnx('month',today(),0,'E'),DATE9.);
%PUT &end_date;
%let start_date= &start_date;
%let end_date=&end_date;
is very neat. Are you looking to loop from start_date to end_date?
Do you want a list to be written to log or an output as a sas dataset?
Ok Now I understand from the accepted solution that you basically wanted a dataset output. I was confused whether you wanted an output as a list file or an output written to the log. Never mind, it's all good
Use data step logic like below and work from there.
data test(keep=date);
firstday=intnx('month', today(), 0, 'b');
lastday=intnx('month', today(), 0, 'e');
do date=firstday to lastday;
output;
end;
format date date9.;
run;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.