How to find out no. of business days in a month using
macros.???(excluding weekends and holidays).

Answers were Sorted based on User's Feedback



How to find out no. of business days in a month using macros.???(excluding weekends and holidays)...

Answer / aaa

%MACRO WORKDAYS(START,END);

DATA _NULL_;
FORMAT A B DDMMYY10.;
A = %SYSFUNC(INPUTN(&START,DDMMYY10.));
B = %SYSFUNC(INPUTN(&END,DDMMYY10.));
COUNT=0;

DO I = A TO B;
IF WEEKDAY(I) IN (2,3,4,5,6) THEN
COUNT=COUNT+1;
END;

PUT 'NUMBER OF WORKING DAYS BETWEEN ' A 'AND ' B '= ' COUNT;
RUN;

%MEND;

%WORKDAYS(01/10/2014,31/10/2014);

Is This Answer Correct ?    7 Yes 0 No

How to find out no. of business days in a month using macros.???(excluding weekends and holidays)...

Answer / oanhntt

first of all, identify the last day of month (using this
intnx('month',d,1)-1). after that make a loop through 1 to
end of month, check if day in loop is weekend or not, using
another variable to count this number.
Regarding to the holidays, except some popular holidays which
I suggest using an external file/dataset to track it, use
this file to identify holidays.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More SAS Interview Questions

How would you include common or reuse code to be processed along with your statements?

3 Answers   Accenture,


Hi, If anyone has base SAS certification dumps, please share.

0 Answers  


How to test the debugging in sas?

0 Answers  


what is scheduling and how will u implement it. In scheduling 5 jobs r running if there is an error occured at 3rd job and how will u check and waht necessary steps will u take not to repeat the same mistake

0 Answers   Blue Star,


what are input dataset and output dataset options? : Sas programming

0 Answers  






how can you import .csv file in to sas? : Sas programming

0 Answers  


what is the difference between floor and ceil functions in sas? : Sas-administrator

0 Answers  


how do i get last 10obs from a dataset when we don't know about the number of obsevations in that dataset?

7 Answers   TCS,


why is sas considered self-documenting? : Sas programming

0 Answers  


SAS System ?

5 Answers  


describe about metadata object? : Sas-di

0 Answers  


What are the features of SAS?

0 Answers  


Categories