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
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 |
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 |
How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730?
What do the PUT and INPUT functions do?
Name some categories in sas 9? : sas-grid-administration
name some data transformation used in sas di? : Sas-di
When merging 2 datasets with a common variable (not merge key), how to keep both?
What is program data vector (pdv) and what are its functions?
In the following DATA step, what is needed for ‘fraction’ to print to the log? data _null_; x=1/3; if x=.3333 then put ‘fraction’; run;
what is enterprise guide? What is the use of it? : Sas programming
what is metadata? : Sas-bi
List out some key concept of SAS
How the date 04oct1994 is stored in SAS,not only give the answer explain in brief?
How do handle working under pressure?