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

i have a macro variable var1,var2. i want titles for the each macro variable separately? how it is possible?

1 Answers   L&T,


What are the main differences between sas versions 8.2, 9.0, 9.1?

4 Answers  


Hot to suppress characters from a given string?

4 Answers   CTS,


what are the types of interactive display types? : Sas-bi

0 Answers  


what are the new features included in the new version of sas i.e., Sas 9.1.3? : Sas programming

0 Answers  






how do you test for missing values? : Sas programming

0 Answers  


What is difference between N and n????

2 Answers   Sciformix,


explain about sas business intelligence? : Sas-bi

0 Answers  


How would you determine how far down on a page you have printed in order to print out footnotes?

3 Answers  


What do you feel about hardcoding?

3 Answers   Pfizer,


What Proc glm does?

0 Answers  


HOW MANY WAYS YOU CAN RETRIEVE THE DATA FROM ORACLE TABLES? WHAT IS ORACLE CLINICAL? HOW IT IS USEFUL?

3 Answers   Accenture, Novartis,


Categories