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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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