x cd /mscdc/sascode/stf3prca.sascode; %let pgm=main; filename pgm "&pgm..sas"; filename calcode '/mscdc/sascode/stf3prca.sascode'; *--This is the main program which creates a compiled SAS program in the mscdc sasctlgs master catalog. The key to running this setup can be found by looking at the testdrive.sas module in this same directory. The code here is critical but unless you need to recompile it need not be accessed directly in order to run the application. --*; %global title profiles setin where; *--The invoking program must provide values for the global parms used in the application. Those are : setin: the input sas dataset containing the data to display. That dataset must have **exactly** the same variables in the stf903.usother dataset. See the testdrive.sas setup in this directory for an example of how to make that work. where: A complete where stmt or equivalent to be inserted in step to create the input dataset/view. title: A title to appear at the top of the reports. profiles: Contains the word "ALL" or a seriel of profile numbers and/or intervals. So profiles=%str(1-10,26,29) is OK. Use 0 as the number for the table of contents page. ************************************************************************ ******** S A S - STF3 ( Summary Tape File 3 ) Census 1990 ***** ************************************************************************ ******** Berkeley version - Berkeley version - Berkeley version ***** ************************************************************************ ******** Edited for use in MVS with Missouri State Census Data Center naming conventions and assuming converted-to-SAS input data set Initial MSCDC revision: 5-20-92. John Blodgett, Urban Info. Center, MSCDC, St. Louis, MO. **Additional editing and converting for UNIX env, 4-99, jgb, now with OSEDA *********; *********************put acknowledgments back************* ; ***NO TIME TO MAKE THIS PRETTY. MANY, MANY THANKS TO THE FOLKS AT THE CALIFORNIA SDC, ESP. LASSE AND ILONA, FOR ALL THE GOOD WORK. ***; PROC DATASETS DDNAME=library; DELETE stf3prca/MEMTYPE=PROGRAM; *--ERASE OLD COPY-; RUN; DATA _NULL_ /pgm=library.stf3prca; SET STF903.usother END=LASTOBS; *<=====; *<===WHEN YOU CREATE THE STORED PROGRAM WHATEVER VALUE YOU USE FOR THE INPUT DATA SET (HERE ITS STF903.us) IS WHAT YOU NEED TO REFERENCE IN YOUR "REDIRECT INPUT=" CLAUSE WHEN RUNNING THE STORED PROGRAM. SEE PUBLIC.APPLCTNS(STF3PRCA) FOR AN EXAMPLE OF RUNNING FROM THE STORED PROGRAM WITHOUT ANY SOURCE CODE INVOLVED; RETAIN; *--ALL VARIABLES-; if p1i1 gt 0 or h1i1 gt 0; *--skip areas no pop & no houses--; FILE print NOTITLES n=ps pagesize=60 linesize=132; LENGTH PROFILES $80; IF _N_=1 THEN DO; _DATE=TODAY(); RPTDATE=PUT(_DATE,MMDDYY8.); LENGTH _TITLE $118; RETAIN _TITLE; _TITLE=SYMGET('TITLE'); _LT=LENGTH(_TITLE); *--CALCULATE COLUMN FOR CENTERING TITLE IN 132-CHAR LINE--; _TITLAT=FLOOR( (132-_LT)/2 ); PROFILES=SYMGET('PROFILES'); _ALL = (PROFILES EQ ' ' OR upcase(PROFILES)='ALL'); END; *--parse the profiles parm and set _pflags string--; length _p $200 _pflags $30; retain _p _pflags; if _p eq ' ' then do; _p=symget('profiles'); _p=upcase(_p); if _p='ALL' then _pflags=repeat('1',29); *--set all flags to true (1)--; else do; _pflags=repeat('0',29); length _w $12 _nw _i1 _i2 8 ; _nw=1; _w=scan(_p,_nw,' ,'); do while(_w ne ' '); if index(_w,'-') then do; _i1=scan(_w,1,'-'); _i2=scan(_w,2,'-'); end; else do; _i1=_w; _i2=_i1; end; do _i=_i1 to _i2; if _i=0 then substr(_pflags,30,1)='1'; else substr(_pflags,_i,1)='1'; end; _nw+1; _w=scan(_p,_nw,' ,'); end; end; end; *--parsing of profiles parm--; if substr(_pflags,30,1)='1' then do; link HEADER; put #4 @_titlat _title; link page00; put _page_; end; %macro dopages; %local i; %do i=1 %to 29; %if &i lt 10 %then %let page=page0&i; %else %let page=page&i; if substr(_pflags,&i,1)='1' then do; link HEADER; put #4 @_titlat _title; link &PAGE; put _page_; end; %end; %mend dopages; %dopages ; RETURN ; *--during testing we broke up source code into these 2 pieces--; %INCLUDE calcode(hdrpgs12); %include calcode(pgs329); RETURN; RUN;