Full disclosure, I was trained on SAS EG, and am not a fully fledged programmer.
I work for a college, and am in charge of the daily enrollment reports. I am trying to automate these reports using INTNX and SYMPUT, but am stumbling over the date format in SYMPUT.
The enrollment reports are compared this year to last, but the dates being compared changes from year to year. The main date change is the 'census' date (census date is when students can no longer drop classes). The enrollment reports compare 'yesterday' to 'this day last year that is the same number of days from census'. Example I want to compare yesterday 03Mar2016 to last year but there are -7 days difference from the census date. So comparing the info of 03Mar2016 to 29Apr2015.
The problem I am having is that the code below runs, without errors, but then when I run the whole program, errors start piling up. I've narrowed the problem to the date format for "Priorname2". In that SYMPUT, date9. will not work, and sasdate. only works when the first part (the code shown) runs, not when the data steps are included.
What can I do to get this time last year, -7 days?
Here is the code I am using to try and automate my report:
options pageno=1 ;
libname COURSE 'K:\Course\SP16\';RUN;
libname COURSE2 'K:\Course\SP15\';RUN;
%LET SEM1 = SP16; RUN;
%LET SEM2 = SP15; RUN;
DATA _NULL_;
Yesterday1 = INTNX('day',today(),-1,'Same');
CALL SYMPUT("PriorDateName", PUT(Yesterday1,date9.));
Last_Year = INTNX('year',today(),-1,'Same');
CALL SYMPUT("PriorName2", PUT(Last_Year, sasdate.));
Last_Yr_Before_Cen = INTNX('day',"&PriorName2",-4,'Same');
CALL SYMPUT("Prior", PUT(Last_Yr_Before_Cen,date9.));
PUT "&PriorDateName";
PUT "&PriorName2"; /*this is a sas date format, used because date9. format was not recognized by the synput function*/
PUT "&Prior";
RUN;
Thank you for any input,
Renee
... View more