1 The SAS System 10:29 Saturday, April 21, 2001 NOTE: Copyright (c) 1999-2000 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software Release 8.1 (TS1M0) Licensed to UNIVERSITY OF MISSOURI AT COLUMBIA-CAMPUSWIDE-T&R, Site 0001242001. NOTE: This session is executing on the AIX 3 platform. NOTE: SAS initialization used: real time 0.11 seconds cpu time 0.05 seconds NOTE: AUTOEXEC processing beginning; file is /home/john/autoexec.sas. v8= 1 ***** ****** MSCDC autoexec rev for V8 01-21-2000 - begin execution ******* Standard filerefs and librefs assigned ***** ****Finished with generic autoexec **** *** ****Excuting my private autoexec.sas file, rev. 10Apr2001 WARNING: Libname LIBRARY is not assigned. NOTE: Libname LIBRARY refers to the same physical library as SASCTLGS. NOTE: Libref LIBRARY was successfully assigned as follows: Engine: V8 Physical Name: /pub/sasctlgs WARNING: No logical assign for filename RLINK. ***** dmsflag= NODMS dmchk execution begins *** **Begin execution on Saturday 21APR01 at 10:29 PID=18714 NOTE: Libref PL942000 was successfully assigned as follows: Engine: V8 Physical Name: /pub/data/pl942000 NOTE: AUTOEXEC processing completed. 1 x cd /pub/data/pl942000/Tools 1 ! ; %let pgm=test_trend_report; filename pgm "&pgm..sas"; 2 /* ----Setup to test pl94trnd macro. Once this works as expected move the embedded pl94trnd macro code to the 3 macro library so it gets used in the basic_trend_report.sas setup that generates these reports "for real". 4 John Blodgett, OSEDA, U. of Missouri Outreach & Extension. March, 2001. 5 ---- */ 6 7 options nodate linesize=132 pagesize=120 formdlim='=' noovp; 8 9 *--libname user '/tmp/user'; 10 libname pl942000 '/pub/data/pl942000'; NOTE: Libref PL942000 was successfully assigned as follows: Engine: V8 Physical Name: /pub/data/pl942000 11 libname pl9490tx '/pub/data/pl9490/pl9490tx' access=readonly; NOTE: Directory for library PL9490TX contains files of mixed engine types. NOTE: Libref PL9490TX was successfully assigned as follows: Engine: V8 Physical Name: /pub/data/pl9490/pl9490tx 11 ! *<--saved 1990 pl94 extracts with 2k geography; 12 libname user '/tmp/scratch/user'; NOTE: Libref USER was successfully assigned as follows: Engine: V8 Physical Name: /tmp/scratch/user 13 14 proc format; 15 value popgrp (fuzz=.01) 1='Total' 2='Hispanic or Latino' 3='White' 4='White: Non Hispanic' 16 5='Black / African American' 6='Asian' 6.5='Asian or Pac Islander' 7='Am. Indian or Alaska Ntv' 17 8='Hawaiian or other PI' 9='Some Other Race' 10='Total Multiracial'; NOTE: Format POPGRP has been output. 18 run; NOTE: PROCEDURE FORMAT used: real time 0.02 seconds cpu time 0.00 seconds 19 20 %macro pl94trnd(inset=,inset90=,sumlevs=,state=,reportby=state, 21 byvars=sumlev geocode,csvfiles=1,maxobs=99999,skeleton=0,arange=,title2=,sort90=0); 22 %*--Macro to generate a standard census 2000 PL94-based trend report. Of course, it will only be 23 a true trend report if inset90 is specfied indicating that you have created comparable data from 24 the 1990 census for the same geography and demographic categories (where it makes sense - some of 25 the categories were not defined in 1990.) 26 John Blodgett, Missouri Census Data Center / OSEDA/ March, 2001. 27 --*; 28 29 %if &skeleton %then %do; %*--create skeleton data set for variable attribs in the pl942000 data lib-; 30 *------Create a skeleton of the report file with variable attributes---------------*; 31 data pl942000.trendr_skeleton(label='Skeleton data set for use with Basic Trend report'); 32 *--define the variables in their left-to-right order in the report--; 33 attrib GeoArea length=$32 label='Geographic Area'; *--Name of area with geocode in parens, e.g. Adair County (29001)-; 34 attrib Year length=$4 ; *--Should have a value of '1990' or '2000'--; 35 attrib PopGroup length=3 label='Population Group' format=popgrp.; *--we store the population group as a numeric code 36 to be turned into a readable label with a custom format--; 37 attrib Values length=$21 label='Value(s) - All Ages' format=$char21.; *--we need to format the values within this 38 character string variable. For race items we can generate an interval such as "bbbbb12,345-12,567" 39 indicating the lower and upper bounds of persons in the race category. For many PopGroups and for 40 all 1990 data there will just be a single, centered value in this field.; 41 attrib Pcts length=$12 label='Pcts' format=$char12.; *--will contain the percentages corresponding to 42 the values stored in Values. Also may be an interval in format xx.x-xxx.x or a single centered pct 43 in 5.1 format.; 44 attrib Values18 length=$21 label='Over 18' format=$char21.; *--See values: same idea but qualified to use 45 only counts of persons age 18 or over--; 46 attrib Pcts18 length=$12 label='Pcts, 18+' format=$char12.; 47 stop; 48 run; 49 %end; *%---if skeleton code-; 50 51 %let arange=%quote(&arange); %*--in case they code "a-d"-; 52 %let title3=; 53 %if %length(&arange)=2 or %length(&arange)=3 %then %do; %*--a value of ad will cause pgm to filter input obs so that 53 ! only 54 those with areanames beginning with A thru D will be kept.----; 55 %local alow ahigh; 56 %let alow=%substr(&arange,1,1); 57 %if %length(&arange)=2 %then %let ahigh=%substr(&arange,2,1); 58 %else %let ahigh=%substr(&arange,3,1); 59 %let alow=%upcase(&alow); %let ahigh=%upcase(&ahigh); 60 %let afilter=%str(where also ) "&alow" <=: areaname <=: "&ahigh" %str(;) ; 61 %let title3=%str(Only Places Starting With Letters &alow thru &ahigh Included in This Report); 2 The SAS System 62 %end; 63 %else %let afilter=%str(); 64 65 66 %if %nrbquote(&title2) ne %str() %then %do; 67 title2 "&title2"; 68 %end; 69 70 %if %nrbquote(&title3) ne %str() %then %do; 71 title3 "&title3"; 72 %end; 73 74 %if &sort90 %then %do; 75 data inset90; set &inset90; 76 where sumlev in (%qlist(&sumlevs)) and totpop > 0; 77 &afilter 78 run; 79 proc sort data=inset90; by &byvars; 80 %let inset90=inset90; 81 %end; 82 83 84 85 data pl94trnd; 86 if 0 then set pl942000.trendr_skeleton; *--sets up the pdv and assigns labels, etc.-; 87 set &inset 88 %if %bquote(&inset90) ne %str() %then %do; 89 &inset90 (in=in90) 90 %end; 91 ; 92 93 where sumlev in (%qlist(&sumlevs)) and totpop > 0; 94 &afilter 95 by &byvars; 96 97 if _n_ gt &maxobs then stop; *<---use this parm for test runs--; 98 if sumlev='140' and not in90 then areaname=substr(areaname,8); *--Edit "Census Tract .." to "Tract "; 99 100 %if %bquote(&inset90) eq %str() %then %do; 101 retain in90 0; drop in90; 102 %end; 103 104 if state=' ' then state="&state"; *<---added 3-19-01--; 105 106 _lgeoarea= length(areaname) + length(geocode) +3; drop _lgeoarea; 107 if _lgeoarea gt 32 then do; 108 *--try to edit names that are too long--; 109 IF INDEX(AREANAME,'SCHOOL DISTRICT') THEN AREANAME=TRANWRD(AREANAME,'SCHOOL DISTRICT','SCH.DST.'); 110 else IF INDEX(AREANAME,'SCHOOL ') THEN AREANAME=TRANWRD(AREANAME,'SCHOOL ','SCH '); 111 else if index(areaname,'County') then areaname=tranwrd(areaname,'County','Co.'); 112 end; 113 114 Geoarea=trim(areaname)||' ('||trim(compress(geocode,'-'))||')'; *--e.g. "California (06)".--; 115 if not in90 then year='2000'; else year='1990'; 116 117 if year='1990' then do; 118 array uplims(*) white2 black2 asian2 indian2 hawnpi2 other2 whitenh2 119 whovr182 blovr182 asovr182 inovr182 haovr182 otovr182 wnovr182 ; 120 array lolims(*) white1 black1 asian1 indian1 hawnpi1 other1 whitenh1 121 whovr181 blovr181 asovr181 inovr181 haovr181 otovr181 wnovr181 ; 122 do _i_=1 to dim(uplims); 123 uplims(_i_)=lolims(_i_); 124 *--by setting this phantom upper limit value to the same as the lower limit we cause the 125 program logic to print only the single value, which is all that make sense for 1990.--; 126 end; 127 end; *--if year='1990' processing--; 128 129 _pfact=100/totpop; if over18 then _pfact18=100/over18; else _pfact18=.; 130 *--total pop--; popgroup=1; 131 values=put(totpop,comma12.); pcts='100.0'; 132 values18=put(over18,comma12.); 133 *_pct=over18*_pfact; * pcts18=put(_pct,5.1); *--changed our mind. Going with pct of total over 18 instead of 134 the over18 in this row as pct of the total pop for the row 134 ! (popgroup); 135 pcts18='100.0'; link output; 136 *--hispanic--; popgroup=2; 137 values=put(hisppop,comma12.); _pct=hisppop*_pfact; pcts=put(_pct,5.1); 138 values18=put(hisovr18,comma12.); _pct=_pfact18*hisovr18; pcts18=put(_pct,5.1); 139 link output; 140 *--White--; popgroup=3; 141 if white1=white2 then do; 142 values=put(white1,comma12.); _pct=white1*_pfact; pcts=put(_pct,5.1); 143 end; 144 else do; 145 values=put(white1,comma9.)||' -'|| put(white2,comma9.); _pct1=white1*_pfact; _pct2=white2*_pfact; 146 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 147 end; 148 if whOvr181=whOvr182 then do; 149 values18=put(whOvr181,comma9.); _pct=_pfact18*whovr181; pcts18=put(_pct,5.1); 150 end; 151 else do; 152 values18=put(whovr181,comma9.)||' -'|| put(whovr182,comma9.); _pct1=_pfact18*whovr181; _pct2=_pfact18*whovr182; 153 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 154 end; 155 link output; 156 *--White, non-hispanic--; popgroup=4; 157 if whitenh1=whitenh2 then do; 158 values=put(whitenh1,comma12.); _pct=whitenh1*_pfact; pcts=put(_pct,5.1); 159 end; 160 else do; 161 values=put(whitenh1,comma9.)||' -'|| put(whitenh2,comma9.); _pct1=whitenh1*_pfact; _pct2=whitenh2*_pfact; 162 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 163 end; 164 if WNOvr181=WNOvr182 then do; 165 values18=put(WNOvr181,comma9.); _pct=_pfact18*WNOvr181; pcts18=put(_pct,5.1); 166 end; 167 else do; 168 values18=put(WNOvr181,comma9.)||' -'|| put(WNOvr182,comma9.); _pct1=_pfact18*WNOvr181; _pct2=_pfact18*WNOvr182; 169 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 170 end; 171 link output; 172 173 *--Black or African American--; popgroup=5; 174 if black1=black2 then do; 175 values=put(black1,comma12.); _pct=black1*_pfact; pcts=put(_pct,5.1); 176 end; 177 else do; 178 values=put(black1,comma9.)||' -'|| put(black2,comma9.); _pct1=black1*_pfact; _pct2=black2*_pfact; 3 The SAS System 179 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 180 end; 181 if BlOvr181=BlOvr182 then do; 182 values18=put(BlOvr181,comma9.); _pct=_pfact18*BlOvr181; pcts18=put(_pct,5.1); 183 end; 184 else do; 185 values18=put(BlOvr181,comma9.)||' -'|| put(BlOvr182,comma9.); _pct1=_pfact18*BlOvr181; _pct2=_pfact18*BlOvr182; 186 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 187 end; 188 link output; 189 190 if year='2000' then do; 191 *--Asian--; popgroup=6; 192 if asian1=asian2 then do; 193 values=put(asian1,comma12.); _pct=asian1*_pfact; pcts=put(_pct,5.1); 194 end; 195 else do; 196 values=put(asian1,comma9.)||' -'|| put(asian2,comma9.); _pct1=asian1*_pfact; _pct2=asian2*_pfact; 197 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 198 end; 199 if AsOvr181=AsOvr182 then do; 200 values18=put(AsOvr181,comma9.); _pct=_pfact18*AsOvr181; pcts18=put(_pct,5.1); 201 end; 202 else do; 203 values18=put(AsOvr181,comma9.)||' -'|| put(AsOvr182,comma9.); _pct1=_pfact18*AsOvr181; 203 ! _pct2=_pfact18*AsOvr182; 204 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 205 end; 206 link output; 207 end; 208 else do; *--year is 1990---; 209 aspovr18=max(aspovr18,aspovr181); *--lets us use either name for the variable-; 210 *--Asian or Pacific Islander--*; popgroup=6.5; 211 values=put(asianpi,comma12.); _pct=asianpi*_pfact; pcts=put(_pct,5.1); 212 values18=put(aspovr18,comma12.); _pct=aspovr18*_pfact18; pcts18=put(_pct,5.1); 213 link output; 214 end; 215 216 *--American Indian, Alaska native--; popgroup=7; 217 if indian1=indian2 then do; 218 values=put(indian1,comma12.); _pct=indian1*_pfact; pcts=put(_pct,5.1); 219 end; 220 else do; 221 values=put(indian1,comma9.)||' -'|| put(indian2,comma9.); _pct1=indian1*_pfact; _pct2=indian2*_pfact; 222 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 223 end; 224 if InOvr181=InOvr182 then do; 225 values18=put(InOvr181,comma9.); _pct=_pfact18*InOvr181; pcts18=put(_pct,5.1); 226 end; 227 else do; 228 values18=put(InOvr181,comma9.)||' -'|| put(InOvr182,comma9.); _pct1=_pfact18*InOvr181; _pct2=_pfact18*InOvr182; 229 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 230 end; 231 link output; 232 233 if year='2000' then do; 234 *--Hawaiian or other PI--; popgroup=8; 235 if hawnPI1=hawnPI2 then do; 236 values=put(hawnPI1,comma12.); _pct=hawnPI1*_pfact; pcts=put(_pct,5.1); 237 end; 238 else do; 239 values=put(hawnPI1,comma9.)||' -'|| put(hawnPI2,comma9.); _pct1=hawnPI1*_pfact; _pct2=hawnPI2*_pfact; 240 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 241 end; 242 if HaOvr181=HaOvr182 then do; 243 values18=put(HaOvr181,comma9.); _pct=_pfact18*HaOvr181; pcts18=put(_pct,5.1); 244 end; 245 else do; 246 values18=put(HaOvr181,comma9.)||' -'|| put(HaOvr182,comma9.); _pct1=_pfact18*HaOvr181; 246 ! _pct2=_pfact18*HaOvr182; 247 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 248 end; 249 link output; 250 end; 251 252 253 *--Some other race--; popgroup=9; 254 if Other1=Other2 then do; 255 values=put(Other1,comma12.); _pct=Other1*_pfact; pcts=put(_pct,5.1); 256 end; 257 else do; 258 values=put(Other1,comma9.)||' -'|| put(Other2,comma9.); _pct1=Other1*_pfact; _pct2=Other2*_pfact; 259 pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); 260 end; 261 if OtOvr181=OtOvr182 then do; 262 values18=put(OtOvr181,comma9.); _pct=_pfact18*OtOvr181; pcts18=put(_pct,5.1); 263 end; 264 else do; 265 values18=put(OtOvr181,comma9.)||' -'|| put(OtOvr182,comma9.); _pct1=_pfact18*OtOvr181; _pct2=_pfact18*OtOvr182; 266 pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); 267 end; 268 link output; 269 270 *--total multiracial--; popgroup=10; 271 if year='2000' then do; 272 values=put(multrace,comma12.); _pct=multrace*_pfact; pcts=put(_pct,5.1); 273 values18=put(mrovr18,comma12.); _pct=_pfact18*mrovr18; pcts18=put(_pct,5.1); 274 link output; 275 end; 276 277 return; 278 output: 279 *--for the value strings just remove all the blanks and replace the dash with ' - ' for spacing. proc report will 280 now center these strings--; 281 values=compress(values); values=tranwrd(values,'-',' - '); 282 values18=compress(values18); values18=tranwrd(values18,'-',' - '); 283 pcts=trim(left(pcts))||'%'; 284 pcts=compress(pcts); pcts=tranwrd(pcts,'-',' - '); 285 286 pcts18=trim(left(pcts18))||'%'; 287 pcts18=compress(pcts18); pcts18=tranwrd(pcts18,'-',' - '); 288 output; 289 return; 290 keep state &reportby geo_id geoarea--pcts18; 291 run; 292 293 proc report data=pl94trnd nowd headline headskip spacing=1 ; 294 *by state notsorted; * format state $state.; 4 The SAS System 295 *label state='State'; 296 %if &reportby ne %str() %then %do; 297 column &reportby; 298 define &reportby /order order=data noprint; 299 compute before _page_; 300 if _break_ ne "&reportby" then 301 line @1 "&reportby: " &reportby $&reportby..; 302 endcomp; 303 304 305 306 compute before &reportby; 307 line @1 "&reportby: " &reportby $&reportby..; 308 endcomp; 309 break after &reportby / skip; 310 %end; 311 312 column geoarea year popgroup; 313 314 column ('-Total-' values pcts); 315 column ('-Over 18-' values18 pcts18); 316 *define state / noprint order order=data; 317 define geoarea /order order=data 'Geographic Area'; 318 define year /order order=internal descending; 319 define popgroup / LEFT format=popgrp. 'Population Group'; 320 define values18 / CENTER 'Value(s)'; 321 define pcts18 / CENTER 'Percent'; 322 define values / CENTER 'Value(s)'; 323 define pcts / CENTER 'Percent'; 324 /*<=========================Comment out===================================== 325 compute before state; 326 line @1 'State: ' state $state.; 327 endcomp; 328 break after state/dol skip; 329 ===========================End commented out================================ */ 330 *break after geoarea / dul; 331 break after year/ skip; 332 333 run; 334 proc printto ; run; *--redirect printed output to avoid variables list generated by cnvtdlm--; 335 336 337 %if &csvfiles %then %do; 338 %if &pdf %then %str( ods printer close; ); 339 %if %quote(&inset) ne %str() %then %do; %*--generate csv file with 2000 data--; 340 341 filename dlmout "&htmldir/&htmlfile.2000.csv"; 342 data csvdata/view=csvdata; 343 set &inset; 344 where sumlev in (%qlist(&sumlevs)) and totpop > 0; 345 keep sumlev &reportby geocode areaname state _numeric_; 346 %if %nrbquote(&reportby)=county or %nrbquote(&reportby)=County %then %str( format county $county.;); 347 run; 348 %cnvtdlm(setin=csvdata,names=1,round=.1) 349 run; 350 filename dlmout clear; 351 352 %end; 353 354 %if %quote(&inset90) ne %str() %then %do; %*--generate csv file with 1990 data--; 355 356 filename dlmout "&htmldir/&htmlfile.1990.csv"; 357 data csvdata2/view=csvdata2; 358 set &inset90; 359 keep sumlev &reportby geocode areaname state _numeric_; 360 %if %nrbquote(&reportby)=county or %nrbquote(&reportby)=County %then %str( format county $county.;); 361 where sumlev in (%qlist(&sumlevs)) and totpop > 0; 362 run; 363 364 %cnvtdlm(setin=csvdata2,names=1,round=.1) 365 run; 366 %end; 367 %end; %*--if csvfiles code--; 368 369 %mend pl94trnd; 370 title 'Public Law Population Trend Report'; 371 footnote 'See http://mcdc2.missouri.edu/webrepts/pl94trend/Notes.html for Background Information'; 372 footnote2 'Programming by OSEDA Under a Contract with the Missouri Census Data Center'; 373 374 *<====================================MACRO=============================================================; 375 %macro doit(state,stab,statenm,geos,arange,byvars=sumlev geocode,html=1,pdf=1,txt=1,csvfiles=1, 376 set90=,set2000=,sort90=0,reportby=,maxobs=99999); 377 %*--This macro handles setting up all the various parameters involved in using the %pl94trnd macro 378 to generate a pl94 trend report. It specifies exactly which geographic entities are to be used 379 , what output formats to generate and what decades we have data for.-- ; 380 381 %let htmlfile=&statenm._&geos&arange; *--e.g. Missouri_Counties --; 382 383 %let htmldir=%str(/pub/webrepts/pl94trend); 384 %let title2=&htmlfile; 385 %if &html %then %do; 386 ods html file="&htmldir/&htmlfile..html" ; 387 *include sascode('styles_default.sas')/nosource2; *---This modules sets the default html styles------; 388 %end; 389 %if &pdf %then %do; 390 ods printer pdf file="&htmldir/&htmlfile..pdf" author='MCDC' ; 391 %end; 392 %if &txt %then %do; 393 proc printto print="&htmldir/&htmlfile..txt" new; run; 394 %end; 395 %else %str(ods listing close;); 396 397 %if &geos=Counties %then %let sumlevp=%str(050 040); 398 %else %if &geos=States %then %let sumlevp=040; 399 %else %if &geos=usregdiv %then %let sumlevp=%str(010 020 030); 400 %else %if &geos=Places %then %let sumlevp=%str(160 161); 401 %else %if &geos=Schools %then %let sumlevp=%str(sde sdu); 402 %else %if &geos=CD106 %then %let sumlevp=%str(500); 403 %else %if &geos=Senate %then %let sumlevp=%str(sen 610); 404 %else %if &geos=House %then %let sumlevp=%str(hse 620); 405 %else %if &geos=TAZ %then %let sumlevp=%str(taz); 406 %else %if &geos=Tracts %then %let sumlevp=%str(140); 407 %else %if &geos=MSAS %then %let sumlevp=%str(300 310); 408 %else %if &geos=rpcs %then %let sumlevp=%str(rpc); 409 %else %if &geos=Regions %then %let sumlevp=%str(reg); 410 %else %if &geos=MCDs %then %let sumlevp=%str(060); 411 %else %if &geos=UMExtsn %then %let sumlevp=%str(umx); 412 %else %if &geos=CZ90 %then %let sumlevp=%str(cz); 5 The SAS System 413 414 415 %pl94trnd(inset90=&set90,inset=&set2000,sumlevs=&sumlevp,byvars=&byvars,arange=&arange,title2=%str(&htmlfile),sort90=&sor 415 ! t90, 416 csvfiles=&csvfiles,state=&state,reportby=&reportby,maxobs=&maxobs); 417 * title2 "&htmlfile"; 418 %if &html %then %str( ods html close; ); 419 420 %if &pdf %then %str( ods printer close; ); 421 422 %mend doit; 423 424 options nomprint; 425 426 options mprint; 427 %doit(20,ks,Kansas,MCDs,,byvars=county geocode,set90=pl9490tx.ksmcds90,set2000=pl942000.kssums,pdf=1,html=0,csvfiles=0, 428 reportby=County,maxobs=99); MPRINT(DOIT): *--e.g. Missouri_Counties --; MPRINT(DOIT): ods printer pdf file="/pub/webrepts/pl94trend/Kansas_MCDs.pdf" author='MCDC' ; WARNING: The PDF option is experimental in this release. NOTE: Writing ODS PRINTER output to file "/pub/webrepts/pl94trend/Kansas_MCDs.pdf" [DISK], printer "PDF". MPRINT(DOIT): proc printto print="/pub/webrepts/pl94trend/Kansas_MCDs.txt" new; MPRINT(DOIT): run; NOTE: PROCEDURE PRINTTO used: real time 0.00 seconds cpu time 0.00 seconds MPRINT(PL94TRND): *%---if skeleton code-; MPRINT(PL94TRND): title2 "Kansas_MCDs"; MPRINT(PL94TRND): data pl94trnd; MPRINT(PL94TRND): if 0 then set pl942000.trendr_skeleton; MPRINT(PL94TRND): *--sets up the pdv and assigns labels, etc.-; MPRINT(PL94TRND): set pl942000.kssums pl9490tx.ksmcds90 (in=in90) ; MPRINT(PL94TRND): where sumlev in ( MPRINT(QLIST): "060" MPRINT(PL94TRND): ) and totpop > 0; MPRINT(PL94TRND): by county geocode; MPRINT(PL94TRND): if _n_ gt 99 then stop; MPRINT(PL94TRND): *<---use this parm for test runs--; MPRINT(PL94TRND): if sumlev='140' and not in90 then areaname=substr(areaname,8); MPRINT(PL94TRND): *--Edit "Census Tract .." to "Tract "; MPRINT(PL94TRND): if state=' ' then state="20"; MPRINT(PL94TRND): *<---added 3-19-01--; MPRINT(PL94TRND): _lgeoarea= length(areaname) + length(geocode) +3; MPRINT(PL94TRND): drop _lgeoarea; MPRINT(PL94TRND): if _lgeoarea gt 32 then do; MPRINT(PL94TRND): *--try to edit names that are too long--; MPRINT(PL94TRND): IF INDEX(AREANAME,'SCHOOL DISTRICT') THEN AREANAME=TRANWRD(AREANAME,'SCHOOL DISTRICT','SCH.DST.'); MPRINT(PL94TRND): else IF INDEX(AREANAME,'SCHOOL ') THEN AREANAME=TRANWRD(AREANAME,'SCHOOL ','SCH '); MPRINT(PL94TRND): else if index(areaname,'County') then areaname=tranwrd(areaname,'County','Co.'); MPRINT(PL94TRND): end; MPRINT(PL94TRND): Geoarea=trim(areaname)||' ('||trim(compress(geocode,'-'))||')'; MPRINT(PL94TRND): *--e.g. "California (06)".--; MPRINT(PL94TRND): if not in90 then year='2000'; MPRINT(PL94TRND): else year='1990'; MPRINT(PL94TRND): if year='1990' then do; MPRINT(PL94TRND): array uplims(*) white2 black2 asian2 indian2 hawnpi2 other2 whitenh2 whovr182 blovr182 asovr182 inovr182 haovr182 otovr182 wnovr182 ; MPRINT(PL94TRND): array lolims(*) white1 black1 asian1 indian1 hawnpi1 other1 whitenh1 whovr181 blovr181 asovr181 inovr181 haovr181 otovr181 wnovr181 ; MPRINT(PL94TRND): do _i_=1 to dim(uplims); MPRINT(PL94TRND): uplims(_i_)=lolims(_i_); MPRINT(PL94TRND): *--by setting this phantom upper limit value to the same as the lower limit we cause the program logic to print only the single value, which is all that make sense for 1990.--; MPRINT(PL94TRND): end; MPRINT(PL94TRND): end; MPRINT(PL94TRND): *--if year='1990' processing--; MPRINT(PL94TRND): _pfact=100/totpop; MPRINT(PL94TRND): if over18 then _pfact18=100/over18; MPRINT(PL94TRND): else _pfact18=.; MPRINT(PL94TRND): *--total pop--; MPRINT(PL94TRND): popgroup=1; MPRINT(PL94TRND): values=put(totpop,comma12.); MPRINT(PL94TRND): pcts='100.0'; MPRINT(PL94TRND): values18=put(over18,comma12.); MPRINT(PL94TRND): *_pct=over18*_pfact; MPRINT(PL94TRND): * pcts18=put(_pct,5.1); MPRINT(PL94TRND): *--changed our mind. Going with pct of total over 18 instead of the over18 in this row as pct of the total pop for the row (popgroup); MPRINT(PL94TRND): pcts18='100.0'; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): *--hispanic--; MPRINT(PL94TRND): popgroup=2; MPRINT(PL94TRND): values=put(hisppop,comma12.); MPRINT(PL94TRND): _pct=hisppop*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): values18=put(hisovr18,comma12.); MPRINT(PL94TRND): _pct=_pfact18*hisovr18; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): link output; MPRINT(PL94TRND): *--White--; MPRINT(PL94TRND): popgroup=3; MPRINT(PL94TRND): if white1=white2 then do; MPRINT(PL94TRND): values=put(white1,comma12.); MPRINT(PL94TRND): _pct=white1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(white1,comma9.)||' -'|| put(white2,comma9.); MPRINT(PL94TRND): _pct1=white1*_pfact; MPRINT(PL94TRND): _pct2=white2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if whOvr181=whOvr182 then do; MPRINT(PL94TRND): values18=put(whOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*whovr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(whovr181,comma9.)||' -'|| put(whovr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*whovr181; MPRINT(PL94TRND): _pct2=_pfact18*whovr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): *--White, non-hispanic--; 6 The SAS System MPRINT(PL94TRND): popgroup=4; MPRINT(PL94TRND): if whitenh1=whitenh2 then do; MPRINT(PL94TRND): values=put(whitenh1,comma12.); MPRINT(PL94TRND): _pct=whitenh1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(whitenh1,comma9.)||' -'|| put(whitenh2,comma9.); MPRINT(PL94TRND): _pct1=whitenh1*_pfact; MPRINT(PL94TRND): _pct2=whitenh2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if WNOvr181=WNOvr182 then do; MPRINT(PL94TRND): values18=put(WNOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*WNOvr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(WNOvr181,comma9.)||' -'|| put(WNOvr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*WNOvr181; MPRINT(PL94TRND): _pct2=_pfact18*WNOvr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): *--Black or African American--; MPRINT(PL94TRND): popgroup=5; MPRINT(PL94TRND): if black1=black2 then do; MPRINT(PL94TRND): values=put(black1,comma12.); MPRINT(PL94TRND): _pct=black1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(black1,comma9.)||' -'|| put(black2,comma9.); MPRINT(PL94TRND): _pct1=black1*_pfact; MPRINT(PL94TRND): _pct2=black2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if BlOvr181=BlOvr182 then do; MPRINT(PL94TRND): values18=put(BlOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*BlOvr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(BlOvr181,comma9.)||' -'|| put(BlOvr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*BlOvr181; MPRINT(PL94TRND): _pct2=_pfact18*BlOvr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): if year='2000' then do; MPRINT(PL94TRND): *--Asian--; MPRINT(PL94TRND): popgroup=6; MPRINT(PL94TRND): if asian1=asian2 then do; MPRINT(PL94TRND): values=put(asian1,comma12.); MPRINT(PL94TRND): _pct=asian1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(asian1,comma9.)||' -'|| put(asian2,comma9.); MPRINT(PL94TRND): _pct1=asian1*_pfact; MPRINT(PL94TRND): _pct2=asian2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if AsOvr181=AsOvr182 then do; MPRINT(PL94TRND): values18=put(AsOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*AsOvr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(AsOvr181,comma9.)||' -'|| put(AsOvr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*AsOvr181; MPRINT(PL94TRND): _pct2=_pfact18*AsOvr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): *--year is 1990---; MPRINT(PL94TRND): aspovr18=max(aspovr18,aspovr181); MPRINT(PL94TRND): *--lets us use either name for the variable-; MPRINT(PL94TRND): *--Asian or Pacific Islander--*; MPRINT(PL94TRND): popgroup=6.5; MPRINT(PL94TRND): values=put(asianpi,comma12.); MPRINT(PL94TRND): _pct=asianpi*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): values18=put(aspovr18,comma12.); MPRINT(PL94TRND): _pct=aspovr18*_pfact18; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): link output; MPRINT(PL94TRND): end; MPRINT(PL94TRND): *--American Indian, Alaska native--; MPRINT(PL94TRND): popgroup=7; MPRINT(PL94TRND): if indian1=indian2 then do; MPRINT(PL94TRND): values=put(indian1,comma12.); MPRINT(PL94TRND): _pct=indian1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(indian1,comma9.)||' -'|| put(indian2,comma9.); MPRINT(PL94TRND): _pct1=indian1*_pfact; MPRINT(PL94TRND): _pct2=indian2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if InOvr181=InOvr182 then do; MPRINT(PL94TRND): values18=put(InOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*InOvr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(InOvr181,comma9.)||' -'|| put(InOvr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*InOvr181; MPRINT(PL94TRND): _pct2=_pfact18*InOvr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): if year='2000' then do; MPRINT(PL94TRND): *--Hawaiian or other PI--; MPRINT(PL94TRND): popgroup=8; 7 The SAS System MPRINT(PL94TRND): if hawnPI1=hawnPI2 then do; MPRINT(PL94TRND): values=put(hawnPI1,comma12.); MPRINT(PL94TRND): _pct=hawnPI1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(hawnPI1,comma9.)||' -'|| put(hawnPI2,comma9.); MPRINT(PL94TRND): _pct1=hawnPI1*_pfact; MPRINT(PL94TRND): _pct2=hawnPI2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if HaOvr181=HaOvr182 then do; MPRINT(PL94TRND): values18=put(HaOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*HaOvr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(HaOvr181,comma9.)||' -'|| put(HaOvr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*HaOvr181; MPRINT(PL94TRND): _pct2=_pfact18*HaOvr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): end; MPRINT(PL94TRND): *--Some other race--; MPRINT(PL94TRND): popgroup=9; MPRINT(PL94TRND): if Other1=Other2 then do; MPRINT(PL94TRND): values=put(Other1,comma12.); MPRINT(PL94TRND): _pct=Other1*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values=put(Other1,comma9.)||' -'|| put(Other2,comma9.); MPRINT(PL94TRND): _pct1=Other1*_pfact; MPRINT(PL94TRND): _pct2=Other2*_pfact; MPRINT(PL94TRND): pcts=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): if OtOvr181=OtOvr182 then do; MPRINT(PL94TRND): values18=put(OtOvr181,comma9.); MPRINT(PL94TRND): _pct=_pfact18*OtOvr181; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): else do; MPRINT(PL94TRND): values18=put(OtOvr181,comma9.)||' -'|| put(OtOvr182,comma9.); MPRINT(PL94TRND): _pct1=_pfact18*OtOvr181; MPRINT(PL94TRND): _pct2=_pfact18*OtOvr182; MPRINT(PL94TRND): pcts18=put(_pct1,4.1)||' -'||put(_pct2,5.1); MPRINT(PL94TRND): end; MPRINT(PL94TRND): link output; MPRINT(PL94TRND): *--total multiracial--; MPRINT(PL94TRND): popgroup=10; MPRINT(PL94TRND): if year='2000' then do; MPRINT(PL94TRND): values=put(multrace,comma12.); MPRINT(PL94TRND): _pct=multrace*_pfact; MPRINT(PL94TRND): pcts=put(_pct,5.1); MPRINT(PL94TRND): values18=put(mrovr18,comma12.); MPRINT(PL94TRND): _pct=_pfact18*mrovr18; MPRINT(PL94TRND): pcts18=put(_pct,5.1); MPRINT(PL94TRND): link output; MPRINT(PL94TRND): end; MPRINT(PL94TRND): return; MPRINT(PL94TRND): output: *--for the value strings just remove all the blanks and replace the dash with ' - ' for spacing. proc report will now center these strings--; MPRINT(PL94TRND): values=compress(values); MPRINT(PL94TRND): values=tranwrd(values,'-',' - '); MPRINT(PL94TRND): values18=compress(values18); MPRINT(PL94TRND): values18=tranwrd(values18,'-',' - '); MPRINT(PL94TRND): pcts=trim(left(pcts))||'%'; MPRINT(PL94TRND): pcts=compress(pcts); MPRINT(PL94TRND): pcts=tranwrd(pcts,'-',' - '); MPRINT(PL94TRND): pcts18=trim(left(pcts18))||'%'; MPRINT(PL94TRND): pcts18=compress(pcts18); MPRINT(PL94TRND): pcts18=tranwrd(pcts18,'-',' - '); MPRINT(PL94TRND): output; MPRINT(PL94TRND): return; MPRINT(PL94TRND): keep state County geo_id geoarea--pcts18; MPRINT(PL94TRND): run; NOTE: Variable aspovr181 is uninitialized. NOTE: There were 4786 observations read from the data set PL942000.KSGEOS. NOTE: There were 4786 observations read from the data set PL942000.KSSUMSNG. NOTE: There were 51 observations read from the data set PL942000.KSSUMS. WHERE (sumlev='060') and (totpop>0); NOTE: There were 51 observations read from the data set PL9490TX.KSMCDS90. WHERE (sumlev='060') and (totpop>0); NOTE: The data set USER.PL94TRND has 890 observations and 10 variables. NOTE: DATA statement used: real time 0.34 seconds cpu time 0.28 seconds MPRINT(PL94TRND): proc report data=pl94trnd nowd headline headskip spacing=1 ; MPRINT(PL94TRND): *by state notsorted; MPRINT(PL94TRND): * format state $state.; MPRINT(PL94TRND): *label state='State'; MPRINT(PL94TRND): column County; MPRINT(PL94TRND): define County /order order=data noprint; MPRINT(PL94TRND): compute before _page_; MPRINT(PL94TRND): if _break_ ne "County" then line @1 "County: " County $County.; MPRINT(PL94TRND): endcomp; MPRINT(PL94TRND): compute before County; MPRINT(PL94TRND): line @1 "County: " County $County.; MPRINT(PL94TRND): endcomp; MPRINT(PL94TRND): break after County / skip; MPRINT(PL94TRND): column geoarea year popgroup; MPRINT(PL94TRND): column ('-Total-' values pcts); MPRINT(PL94TRND): column ('-Over 18-' values18 pcts18); MPRINT(PL94TRND): *define state / noprint order order=data; MPRINT(PL94TRND): define geoarea /order order=data 'Geographic Area'; MPRINT(PL94TRND): define year /order order=internal descending; MPRINT(PL94TRND): define popgroup / LEFT format=popgrp. 'Population Group'; MPRINT(PL94TRND): define values18 / CENTER 'Value(s)'; MPRINT(PL94TRND): define pcts18 / CENTER 'Percent'; MPRINT(PL94TRND): define values / CENTER 'Value(s)'; MPRINT(PL94TRND): define pcts / CENTER 'Percent'; MPRINT(PL94TRND): *break after geoarea / dul; MPRINT(PL94TRND): break after year/ skip; MPRINT(PL94TRND): run; 8 The SAS System MPRINT(PL94TRND): line @1 "County: " County $County.; MPRINT(PL94TRND): if _break_ ne "County" then line @1 "County: " County $County.; MPRINT(PL94TRND): line @1 "County: " County $County.; MPRINT(PL94TRND): if _break_ ne "County" then line @1 "County: " County $County.; NOTE: There were 890 observations read from the data set USER.PL94TRND. NOTE: The PROCEDURE REPORT printed pages 1-10. NOTE: PROCEDURE REPORT used: real time 1.57 seconds cpu time 1.12 seconds MPRINT(PL94TRND): proc printto ; MPRINT(PL94TRND): run; NOTE: PROCEDURE PRINTTO used: real time 0.01 seconds cpu time 0.00 seconds MPRINT(PL94TRND): *--redirect printed output to avoid variables list generated by cnvtdlm--; MPRINT(DOIT): ; MPRINT(DOIT): * title2 "&htmlfile"; MPRINT(DOIT): ods printer close; Infomation author: MCDC NOTE: ODS PRINTER printed 26 pages to /pub/webrepts/pl94trend/Kansas_MCDs.pdf. 429 430 431 432 433 434 435 run; 436 437 %include sascode(notify); **** test_trend_report (18714) has completed Saturday 21APR01 10:29 syserr=0 ***** NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 2.99 seconds cpu time 1.92 seconds