1 The SAS System 08:05 Thursday, June 1, 2017 NOTE: Copyright (c) 2002-2008 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.2 (TS2M2) Licensed to THE CURATORS OF THE UNIV OF MISSOURI - T&R, Site 70084282. NOTE: This session is executing on the Linux 2.6.18-417.el5 (LIN X64) platform. You are running SAS 9. Some SAS 8 files will be automatically converted by the V9 engine; others are incompatible. Please see http://support.sas.com/rnd/migration/planning/platform/64bit.html PROC MIGRATE will preserve current SAS file attributes and is recommended for converting all your SAS libraries from any SAS 8 release to SAS 9. For details and examples, please see http://support.sas.com/rnd/migration/index.html This message is contained in the SAS news file, and is presented upon initialization. Edit the file "news" in the "misc/base" directory to display site-specific news and information in the program log. The command line option "-nonews" will prevent this display. NOTE: SAS initialization used: real time 0.02 seconds cpu time 0.00 seconds NOTE: AUTOEXEC processing beginning; file is /home/blodgettj/autoexec.sas. ****** Standard OSEDA/MCDC autoexec (autoexec9.sas in sascode) rev. 8/20/2015 12:03:05 PM - Begin execution ******* Standard filerefs and librefs assigned ***** NOTE: Libref BASETBLS was successfully assigned as follows: Engine: V9 Physical Name: /pub/data/acs2015/basetbls NOTE: Libref BTABS was successfully assigned as follows: Levels: 1 Engine(1): V9 Physical Name(1): /pub/data/acs2015/basetbls NOTE: Libref BTABS5 was successfully assigned as follows: Engine: V9 Physical Name: /pub/data/acs2015/btabs5yr NOTE: Libref ACS2015 was successfully assigned as follows: Engine: V9 Physical Name: /pub/data/acs2015 NOTE: AUTOEXEC processing completed. 1 x cd /pub/data/acs/Tools 1 ! ; %let pgm=test_povtplus; filename pgm "&pgm..sas"; 2 *---Experimental program to create specially collapsed version of ACS base/summary tables. Specically, 3 those with poverty data. We want to get rid of the "Over poverty" cells but create new Pct variables 4 for all the below poverty cells. 5 We also support an option that allows user to specify no sex detail (so all male/female cells describing 2 The SAS System 08:05 Thursday, June 1, 2017 6 the same thing are added. 7 J. Blodgett, OSEDA, under contract with Mo State Library. 8 Begin 5-31-17. 9 10 libname btabs '/pub/data/acs2015/basetbls'; 11 libname user '/tmp/scratch/user'; NOTE: Libref USER was successfully assigned as follows: Engine: V9 Physical Name: /tmp/scratch/user 12 13 options mprint; 14 15 16 %macro povtplus (tableID, /* base tables id such as b17002 or b17010A - case does not matter */ 17 cell1below=2,cell1above=, /* Point to table cells where the below and above data start. */ 18 cell1Male=0,cell1female= ); /* if interested in collapsing across sex then indicate first cells where 19 the data for each gender occur first. */ 20 %global ei; %if &ei=%str() %then %let ei=i; 21 %local tabi; %let tabi=&tableid.&ei; %*--the table name followed by i or e --; 22 %let tabli=&tableid.&ei; 23 %local npovcells; %let npovcells=%eval(&cell1above - &cell1below); 24 %let lastcellbelow=%eval(&cell1above -1); 25 26 array &tableid(*) &tabi.: ; 27 array Pct&tableid(&cell1below:&lastcellbelow) Pct&tabi.&cell1below - Pct&tabi&lastcellbelow; 28 29 do _i=&cell1below to %eval(&cell1above - 1); 30 _abovei=_i + &npovcells; 31 *--add corresponding below and above cells--; 32 _bplusa=&tableid(_i) + &tableid(_abovei); 33 *--Assign the poverty rate variable--; 34 if _bplusa > 0 then Pct&tableid(_i)=100*&tableid(_i)/_bplusa; 35 end; 36 keep &tabi.1- &tabi.&lastcellbelow Pct&tabi.: ; 37 format Pct&tableid: 5.1; 38 %mend povtplus; 39 40 data user.b17002; 41 set btabs.ustabs17_20 (keep=geoid areaname b17001i: b17003i: obs=1); 42 %povtplus(b17001,cell1above=31); MPRINT(POVTPLUS): array b17001(*) b17001i: ; MPRINT(POVTPLUS): array Pctb17001(2:30) Pctb17001i2 - Pctb17001i30; MPRINT(POVTPLUS): do _i=2 to 30; MPRINT(POVTPLUS): _abovei=_i + 29; MPRINT(POVTPLUS): *--add corresponding below and above cells--; MPRINT(POVTPLUS): _bplusa=b17001(_i) + b17001(_abovei); MPRINT(POVTPLUS): *--Assign the poverty rate variable--; MPRINT(POVTPLUS): if _bplusa > 0 then Pctb17001(_i)=100*b17001(_i)/_bplusa; MPRINT(POVTPLUS): end; MPRINT(POVTPLUS): keep b17001i1- b17001i30 Pctb17001i: ; MPRINT(POVTPLUS): format Pctb17001: 5.1; 43 %povtplus(b17003,cell1above=13); MPRINT(POVTPLUS): array b17003(*) b17003i: ; MPRINT(POVTPLUS): array Pctb17003(2:12) Pctb17003i2 - Pctb17003i12; MPRINT(POVTPLUS): do _i=2 to 12; MPRINT(POVTPLUS): _abovei=_i + 11; 3 The SAS System 08:05 Thursday, June 1, 2017 MPRINT(POVTPLUS): *--add corresponding below and above cells--; MPRINT(POVTPLUS): _bplusa=b17003(_i) + b17003(_abovei); MPRINT(POVTPLUS): *--Assign the poverty rate variable--; MPRINT(POVTPLUS): if _bplusa > 0 then Pctb17003(_i)=100*b17003(_i)/_bplusa; MPRINT(POVTPLUS): end; MPRINT(POVTPLUS): keep b17003i1- b17003i12 Pctb17003i: ; MPRINT(POVTPLUS): format Pctb17003: 5.1; 44 put / _all_; 45 keep _character_; 46 run; geoid=01000US AreaName=United States B17001i1=313476400 B17001i2=46153077 B17001i3=20599407 B17001i4=2249826 B17001i5=455160 B17001i6=2631142 B17001i7=1150989 B17001i8=390150 B17001i9=728066 B17001i10=2960657 B17001i11=2494283 B17001i12=2016312 B17001i13=2046775 B17001i14=1991651 B17001i15=886460 B17001i16=597936 B17001i17=25553670 B17001i18=2198385 B17001i19=428057 B17001i20=2545922 B17001i21=1114946 B17001i22=381805 B17001i23=725825 B17001i24=3621707 B17001i25=3879329 B17001i26=3019798 B17001i27=2549636 B17001i28=2380221 B17001i29=1360028 B17001i30=1348011 B17001i31=267323323 B17001i32=132827872 B17001i33=7708668 B17001i34=1533804 B17001i35=9836942 B17001i36=5048737 B17001i37=1771927 B17001i38=3498287 B17001i39=11374862 B17001i40=18884026 B17001i41=17759596 B17001i42=18822102 B17001i43=17464253 B17001i44=11848961 B17001i45=7275707 B17001i46=134495451 B17001i47=7332523 B17001i48=1468494 B17001i49=9419264 B17001i50=4825660 B17001i51=1680741 B17001i52=3329466 B17001i53=10180582 B17001i54=17778052 B17001i55=17410618 B17001i56=19247161 B17001i57=18703007 B17001i58=13193788 B17001i59=9926095 B17001Ii1=55356136 B17001Ii2=12505613 B17001Ii3=5677640 B17001Ii4=815101 B17001Ii5=167908 B17001Ii6=994328 B17001Ii7=415376 B17001Ii8=130680 B17001Ii9=241226 B17001Ii10=645256 B17001Ii11=659716 B17001Ii12=641873 B17001Ii13=418425 B17001Ii14=290098 B17001Ii15=154449 B17001Ii16=103204 B17001Ii17=6827973 B17001Ii18=818340 B17001Ii19=155852 B17001Ii20=941895 B17001Ii21=400392 B17001Ii22=128458 B17001Ii23=236295 B17001Ii24=793994 B17001Ii25=1066531 B17001Ii26=946289 B17001Ii27=532608 B17001Ii28=382829 B17001Ii29=234969 B17001Ii30=189521 B17001Ii31=42850523 B17001Ii32=22067515 B17001Ii33=1738600 B17001Ii34=333925 B17001Ii35=2132528 B17001Ii36=1048611 B17001Ii37=355036 B17001Ii38=713305 B17001Ii39=2607512 B17001Ii40=3829916 B17001Ii41=3440077 B17001Ii42=2799913 B17001Ii43=1745513 B17001Ii44=862845 B17001Ii45=459734 B17001Ii46=20783008 B17001Ii47=1645275 B17001Ii48=318766 B17001Ii49=2075297 B17001Ii50=1014285 B17001Ii51=342042 B17001Ii52=675242 B17001Ii53=2298021 B17001Ii54=3170211 B17001Ii55=3059947 B17001Ii56=2685169 B17001Ii57=1819713 B17001Ii58=1008159 B17001Ii59=670881 B17003i1=212883806 B17003i2=24570440 B17003i3=10033417 B17003i4=3061784 B17003i5=3407824 B17003i6=2288996 B17003i7=1274813 B17003i8=14537023 B17003i9=4034248 B17003i10=4792580 B17003i11=4022034 B17003i12=1688161 B17003i13=188313366 B17003i14=92054645 B17003i15=10413972 B17003i16=25255212 B17003i17=26186574 B17003i18=30198887 B17003i19=96258721 B17003i20=9301348 B17003i21=24766558 B17003i22=29424267 B17003i23=32766548 Pctb17001i2=14.7 Pctb17001i3=13.4 Pctb17001i4=22.6 Pctb17001i5=22.9 Pctb17001i6=21.1 Pctb17001i7=18.6 Pctb17001i8=18.0 Pctb17001i9=17.2 Pctb17001i10=20.7 Pctb17001i11=11.7 Pctb17001i12=10.2 Pctb17001i13=9.8 Pctb17001i14=10.2 Pctb17001i15=7.0 Pctb17001i16=7.6 Pctb17001i17=16.0 Pctb17001i18=23.1 Pctb17001i19=22.6 Pctb17001i20=21.3 Pctb17001i21=18.8 Pctb17001i22=18.5 Pctb17001i23=17.9 Pctb17001i24=26.2 Pctb17001i25=17.9 Pctb17001i26=14.8 Pctb17001i27=11.7 Pctb17001i28=11.3 Pctb17001i29=9.3 Pctb17001i30=12.0 _i=13 _abovei=23 _bplusa=34454709 Pctb17003i2=11.5 Pctb17003i3=9.8 Pctb17003i4=22.7 Pctb17003i5=11.9 Pctb17003i6=8.0 Pctb17003i7=4.1 Pctb17003i8=13.1 Pctb17003i9=30.3 Pctb17003i10=16.2 Pctb17003i11=12.0 Pctb17003i12=4.9 _ERROR_=0 _N_=1 NOTE: There were 1 observations read from the data set BTABS.USTABS17_20. NOTE: The data set USER.B17002 has 1 observations and 84 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds 47 48 %include sascode(notify); 0 **** test_povtplus (18317) has completed 01JUN17 8:05:32 syserr=0 sysrc= 0 ***** NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 0.08 seconds cpu time 0.01 seconds