I am attempting to use the following code to generate separate pdf documents for each of the 85 districts. However, the code is outputting 85 pdf documents each containing 85 tables for the distinct districts. How might I be able to change the code to accomplish this? Or is there an altogether easier approach? Thank you for your help.
%let districtcode=; %let inputfile = work.Ind_14_Exiters ; *from previous step; %let outfile = Ind14_Report; %let FinalOutFileTest = "W:\SASDEV\OSES\Indicator\&districtcode..pdf";
data &outfile; set &inputfile(rename=(districtid=districtcode)); ;
* if testtype = 'SCREADY' or testtype = 'NCSC'; * DISTRICT = ""; * retain ID Grade_Level Performance_Level_HSASSESS_ELA Performance_Level_HSASSESS_MTH SCHOOLID SCPASS_PerformanceLevel_ELA SCPASS_PerformanceLevel_Math STUDENTID Test_Date Year_ID STUDENT_NUMBER2 LAST_NAME2 FIRST_NAME2 MIDDLE_NAME2 GenerationCode districtcode StateID DistrictCode3; * (RENAME =());
length new_districtcode $ 4; new_districtcode=districtcode; new_districtcode = translate(right(new_districtcode),'0',' '); drop districtcode; rename new_districtcode=districtcode;
Pad000 = '000'; length DistrictCode3 $ 7.; DistrictCode3 = cats(districtcode,Pad000); * %let DistrictCode3 = DistrictCode3; drop Pad000; * drop DistrictCode3; /* nTest_Date = put(Test_Date,mmddyy10.); drop Test_Date; rename nTest_Date = Test_Date; */ run;
PROC FREQ data= &outfile; TABLES districtcode*DistrictCode3/LIST MISSING OUT=WRITEDISTRICTS;run; DATA _NULL_; *LENGTH TEMP$213;
FILE'W:\SASDEV\OSES\macro_calls_dont_delete.sas';
set writedistricts;
TEMP=COMPBL('%processdistrict('||districtcode||','||DistrictCode3||')'); put TEMP; RUN;
PROC SORT DATA=&outfile; BY districtcode ;
RUN;
%MACRO PROCESSDISTRICT(districtcode,DistrictCode3);
ODS PDF FILE="W:\SASDEV\OSES\Indicator\&districtcode..pdf" STYLE=Pearl;
TITLE; TITLE1 "Post-Secondary Outcomes Survey Results"; FOOTNOTE; FOOTNOTE1 "Competitive Employment requires that all of the following criteria be met: (1) worked at least 90 days; (2) Earned minimum wage; (3) worked at least 20 hours per week.";
PROC TABULATE DATA=&outfile; VAR Exiters "Survey Respondents"n "Higher Education Only (College)"n "Higher Ed and Competitive"n "Competitive Employment Only"n "Vocational/Technical School Only"n "Voc and Competitively Employed"n "Other School or Employment"n "No Work/No Education"n; CLASS ReportingDisability / ORDER=UNFORMATTED MISSING; CLASS District_Renamed / ORDER=UNFORMATTED MISSING; TABLE /* Page Dimension */ District_Renamed, /* Row Dimension */ ReportingDisability*( Exiters={STYLE={BACKGROUND=#FFFF00}}*{STYLE={BACKGROUND=#FFFF00}} 'Survey Respondents'n={STYLE={BACKGROUND=#FFFF00}}*{STYLE={BACKGROUND=#FFFF00}} 'Higher Education Only (College)'n 'Higher Ed and Competitive'n 'Competitive Employment Only'n 'Vocational/Technical School Only'n 'Voc and Competitively Employed'n 'No Work/No Education'n 'Other School or Employment'n), /* Column Dimension */ Max={LABEL="Total"}*F=BEST3. ; ;
RUN; /* ------------------------------------------------------------------- End of task code ------------------------------------------------------------------- */ RUN; QUIT; TITLE; FOOTNOTE;
ODS PDF CLOSE;
%MEND PROCESSDISTRICT;
FILENAME RUNTHIS 'W:\SASDEV\OSES\macro_calls_dont_delete.sas'; %INCLUDE RUNTHIS; RUN;
... View more