/* Example for reading the 2000 SF1 merged hierarchical data. */ libname datdir '/usr/shared/cathys'; /* replace /usr/shared/cathys with own work area */ options compress=yes; options ls = 120; filename stf pipe 'zcat /usr/data/public/us/government/stf/2000/stf1/merged/*sf1.Z'; /* This file currently looks at all of the states. If you are only interested in one particular state replace the asterick in *sf1 with desired state abreviation, i.e. ohsf1.Z. for Ohio. */ data sf1; retain sumlev geocomp chariter region division statece state county place tract blkfrp msacmsa cmsa pmsa necma name; infile stf dsd lrecl = 2500 pad missover; input segment 1-2 @; select (segment); when (0) do; input sumlev 9-11 geocomp 12-13 chariter 14-16 region 26 division 27 statece 28-29 state 30-31 county 32-34 place 46-50 tract 56-61 blkgrp 62 msacmsa 107-110 cmsa 113-114 macci 115 pmsa 116-119 necma 120-123 name $ 201-290; end; when (1) do; input @24 P001001 P002001-P002006 P003001-P003071 P004001-P004073 P005001-P005071; end; when (2) do; input @24 P006001-P006073 P007001-P007008 P008001-P008017 P009001-P009007 P010001-P010015 P011001 P012001-P012049 P013001-P013003 P014001-P014043 P015001 P016001 P017001 P018001-P018019 ; end; when (3) do; input @24 P019001-P019019 P020001-P020031 P021001-P021019 P022001-P022011 P023001-P023011 P024001-P024011 P025001-P025003 P026001-P026016 P027001-P027027 P028001-P028017 P029001-P029046 P030001-P030022 P031001 P032001 P033001; end; when (4) do; input @24 P034001-P034020 P035001-P035020 P036001-P036020 P037001-P037009 P038001-P038057 P039001-P039005 P040001-P040003 P041001-P041003 P042001-P042003 P043001-P043003 P044001-P044003 P045001-P045003 ; end; when (5) do; input @24 P012A001-P012A049 P012B001-P012B049 P012C001-P012C049 P012D001-P012D049 P012E001-P012E049 ; end; when (6) do; input @24 P012F001-P012F049 P012G001-P012G049 P012H001-P012H049 P012I001-P012I049 P013A001-P013A003 P013B001-P013B003 P013C001-P013C003 P013D001-P013D003 P013E001-P013E003 P013F001-P013F003 P013G001-P013G003 P013H001-P013H003 P013I001-P013I003 P015A001 P015B001 P015C001 P015D001 P015E001 P015F001 P015G001 P015H001 P015I001 P016A001 P016B001 P016C001 P016D001 P016E001 P016F001 P016G001 P016H001 P016I001; end; when (7) do; input @24 P017A001 P017B001 P017C001 P017D001 P017E001 P017F001 P017G001 P017H001 P017I001 P026A001-P026A016 P026B001-P026B016 P026C001-P026C016 P026D001-P026D016 P026E001-P026E016 P026F001-P026F016 P026G001-P026G016 P026H001-P026H016 P026I001-P026I016 P027A001-P027A027 P027B001-P027B027 P027C001-P027C027; end; when (8) do; input @24 P027D001-P027D027 P027E001-P027E027 P027F001-P027F027 P027G001-P027G027 P027H001-P027H027 P027I001-P027I027 P028A001-P028A017 P028B001-P028B017 P028C001-P028C017 P028D001-P028D017 P028E001-P028E017 ; end; when (9) do; input @24 P028F001-P028F017 P028G001-P028G017 P028H001-P028H017 P028I001-P028I017 P030A001-P030A022 P030B001-P030B022 P030C001-P030C022 P030D001-P030D022 P030E001-P030E022 P030F001-P030F022 P030G001-P030G022 P030H001-P030H022; end; when (10) do; input @24 P030I001-P030I022 P031A001 P031B001 P031C001 P031D001 P031E001 P031F001 P031G001 P031H001 P031I001 P032A001 P032B001 P032C001 P032D001 P032E001 P032F001 P032G001 P032H001 P032I001 P033A001 P033B001 P033C001 P033D001 P033E001 P033F001 P033G001 P033H001 P033I001 P034A001-P034A020 P034B001-P034B020 P034C001-P034C020 P034D001-P034D020 P034E001-P034E020 P034F001-P034F020 P034G001-P034G020 P034H001-P034H020 P034I001-P034I020 ; end; when (11) do; input @24 P035A001-P035A020 P035B001-P035B020 P035C001-P035C020 P035D001-P035D020 P035E001-P035E020 P035F001-P035F020 P035G001-P035G020 P035H001-P035H020 P035I001-P035I020 ; end; when (12) do; input @24 P035A001-P035A020 P035B001-P035B020 P035C001-P035C020 P035D001-P035D020 P035E001-P035E020 P035F001-P035F020 P035G001-P035G020 P035H001-P035H020 P035I001-P035I020 PC01001-PC01047 PC02001-PC02047 PC03001-PC03047 PC04001-PC04009 PC05001-PC05019 PC06001-PC06019 PC07001-PC07019 PC08001-PC08014 PC09001-PC09014 ; end; when (13) do; input @24 PC10001-PC10014 PC11001-PC11031; end; when (14) do; input @24 PC12001-PC12209 ; end; when (15) do; input @24 PC13001-PC13049 PC14001-PC14007 PC15001-PC15013 PC16001-PC16052 PC17001-PC17075 ; end; when (16) do; input @24 PC12A001-PC12A209 ; end; when (17) do; input @24 PC12B001-PC12B209 ; end; when (18) do; input @24 PC12C001-PC12C209 ; end; when (19) do; input @24 PC12D001-PC12D209 ; end; when (20) do; input @24 PC12E001-PC12E209 ; end; when (21) do; input @24 PC12F001-PC12F209 ; end; when (22) do; input @24 PC12G001-PC12G209 ; end; when (23) do; input @24 PC12H001-PC12H209 ; end; when (24) do; input @24 PC12I001-PC12I209 ; end; when (25) do; input @24 PC12J001-PC12J209 ; end; when (26) do; input @24 PC12K001-PC12K209 ; end; when (27) do; input @24 PC12L001-PC12L209 ; end; when (28) do; input @24 PC12M001-PC12M209 ; end; when (29) do; input @24 PC12N001-PC12N209 ; end; when (30) do; input @24 PC12O001-PC12O209 ; end; when (31) do; input @24 PC13A001-PC13A049 PC13B001-PC13B049 PC13C001-PC13C049 PC13D001-PC13D049 PC13E001-PC13E049 ; end; when (32) do; input @24 PC13F001-PC13F049 PC13G001-PC13G049 PC13H001-PC13H049 PC13I001-PC13I049 PC15A001-PC15A013 PC15B001-PC15B013 PC15C001-PC15C013; end; when (33) do; input @24 PC15D001-PC15D013 PC15E001-PC15E013 PC15F001-PC15F013 PC15G001-PC15G013 PC15H001-PC15H013 PC15I001-PC15I013 PC17A001-PC17A075 PC17B001-PC17B075 ; end; when (34) do; input @24 PC17C001-PC17C075 PC17D001-PC17D075 PC17E001-PC17E075; end; when (35) do; input @24 PC17F001-PC17F075 PC17G001-PC17G075 PC17H001-PC17H075 ; end; when (36) do; input @24 PC17I001-PC17I075 ; end; when (37) do; input @24 H001001 H002001-H002006 H003001-H003003 H004001-H004003 H005001-H005007 H006001-H006008 H007001-H007017 H008001-H008007 H009001-H009015 H010001 H011001-H011003 H012001-H012003 H013001-H013008 H014001-H014017 H015001-H015017 H016001-H016019 H017001-H017069 H018001-H018003 H019001-H019005 H020001-H020005; end; when (38) do; input @24 H011A001-H011A003 H011B001-H011B003 H011C001-H011C003 H011D001-H011D003 H011E001-H011E003 H011F001-H011F003 H011G001-H011G003 H011H001-H011H003 H011I001-H011I003 H012A001-H012A003 H012B001-H012B003 H012C001-H012C003 H012D001-H012D003 H012E001-H012E003 H012F001-H012F003 H012G001-H012G003 H012H001-H012H003 H012I001-H012I003 H015A001-H015A017 H015B001-H015B017 H015C001-H015C017 H015D001-H015D017 H015E001-H015E017 H015F001-H015F017 H015G001-H015G017 H015H001-H015H017 H015I001-H015I017 ; end; when (39) do; input @24 H016A001-H016A019 H016B001-H016B019 H016C001-H016C019 H016D001-H016D019 H016E001-H016E019 H016F001-H016F019 H016G001-H016G019 H016H001-H016H019 H016I001-H016I019 ; end; end; /* Select the data segments containing variables you are interested in.*/ if segment=1 or segment=37; /* Select the summary levels and geo components representing the geographic heirarchy you want to analyse.*/ if sumlev=40 and geocomp=00; run; proc freq; tables P001001 P002001-P002006 H001001 H002001-H002006; run;