BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sivastat08
Pyrite | Level 9

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

8 REPLIES 8
novinosrin
Tourmaline | Level 20

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?

sivastat08
Pyrite | Level 9
Yes Sir,Output Should list Current month days
novinosrin
Tourmaline | Level 20

Do you want a list to be written to log or an output as a sas dataset?

sivastat08
Pyrite | Level 9
OUTPUT SIR.
novinosrin
Tourmaline | Level 20

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 

sivastat08
Pyrite | Level 9
Thank you very much Sir
PeterClemmensen
Tourmaline | Level 20

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;
sivastat08
Pyrite | Level 9
Thanks For The Answer Sir

sas-innovate-white.png

Special offer for SAS Communities members

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.

 

View the full agenda.

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
  • 8 replies
  • 3270 views
  • 3 likes
  • 3 in conversation