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

Write a SAS macro to calculate number of numbers in an email address

2 Answers  


what is the use of proc sql? : Sas programming

0 Answers  


what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming

0 Answers  


What are symbol tables?Differemce between Local N Global Symbol tables.....

2 Answers   TCS,


I am looking to buy a sas advance book. So any one can guide me that which one i should buy.

0 Answers  






There are 200 observations in a dataset, i want to pull out the observation no's 100, 150,180,190 by using Proc SQL? How you can get it?

5 Answers  


What do you know about sas and what we do? : sas-grid-administration

0 Answers  


Name statements that are execution only?

7 Answers  


how to delete the duplicate columns permanently in SQL

2 Answers   Satyam,


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

0 Answers  


What techniques and/or PROCs do you use for tables?

4 Answers   Oracle,


What is the Program Data Vector (PDV)? What are its functions?

5 Answers   Accenture,


Categories