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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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