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

Hi everyone,

 

i need to create table on post 14th weekday fo the month,  i have macro which store current month and year. for eg. lets say rpprd=201512, so my requirement is create table only after 14th weekday of the current month. so for this month it will be after 18th-Dec-2015 i can create table. so the check is only on the current date, which should not not between 1st to 14th weekday of the current month in order to create table.

 

so something like below i want.

 

%if (%sysfunc(today() = 1st to 14th weekday of the current month)) then do;

 

%put "can't create table as per rule" ;

%end;

%else; %do;

proc sql;

create table xyz;

quit;

%end;

 

 Thanks in advance,

Regards,

Tushar J

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Did you check INTNX() + weekday ?

 

 

%let year=2015;
%let month=12;
%let want=%sysfunc(intnx(weekday,%sysfunc(mdy(&month,1,&year)),14),date11.);
%put &want ;

View solution in original post

3 REPLIES 3
Ksharp
Super User

Did you check INTNX() + weekday ?

 

 

%let year=2015;
%let month=12;
%let want=%sysfunc(intnx(weekday,%sysfunc(mdy(&month,1,&year)),14),date11.);
%put &want ;
Tushar
Obsidian | Level 7

HI ,

thanks for your reply, however i am getting error after executing below code on EG SAS 9.1.3.

 

%let year=2015;
%let month=12;
%let want=%sysfunc(intnx(weekday,%sysfunc(mdy(&month,1,&year)),14),date11.);
%put &want ;

 

ERROR: Format name DATE11. not found or the width and/or decimal specified for the format used are out of range. 

Tushar
Obsidian | Level 7

However changing format from date11. to date9. gave me correct date. Thanks for your reply and your logic 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1135 views
  • 0 likes
  • 2 in conversation