DATA Step, Macro, Functions and more

create table post 14th working day of the current month using SAS 9.1.3.

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 88
Accepted Solution

create table post 14th working day of the current month using SAS 9.1.3.

[ Edited ]

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


Accepted Solutions
Solution
‎12-28-2015 03:06 AM
Super User
Posts: 10,044

Re: create table post 14th working day of the current month using SAS 9.1.3.

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


All Replies
Solution
‎12-28-2015 03:06 AM
Super User
Posts: 10,044

Re: create table post 14th working day of the current month using SAS 9.1.3.

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 ;
Frequent Contributor
Posts: 88

Re: create table post 14th working day of the current month using SAS 9.1.3.

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. 

Frequent Contributor
Posts: 88

Re: create table post 14th working day of the current month using SAS 9.1.3.

[ Edited ]

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

 

 

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 223 views
  • 0 likes
  • 2 in conversation