/* NC_county_unemp_read.sas -- a SAS program to read county-*/ /* level monthly unemployment rates from the BLS/LAUS */ /* database for North Carolina */ /* Author: D. Ribar 5 Sept. 2008 */ TITLE "North Carolina County Unemployment Rates"; DATA t1; /* The BLS/LAUS data come tab-delimited; will use */ /* EXPANDTABS option to remove the tabs and will use */ /* column position indicators to pick off different */ /* parts of the series identifiers */ INFILE 'R:\My Documents\ECO 725\la_data_40_NC.txt' EXPANDTABS; INPUT survtype $ 1- 2 seasonal $ 3- 3 areatype $ 4- 5 st_fips $ 6- 7 sub_area 8-11 meascode 12-13 year_var m_ch_var $ ser_var; /* First select series for unemployment rates */ IF meascode EQ 3; /* Next select counties */ /* (see ftp://ftp.bls.gov/pub/time.series/la/la.area) */ IF areatype EQ 'CN' OR (areatype EQ 'PA' AND sub_area IN (0300, 0520, 0600, 0650, 0700, 0750, 0800, 0850, 0950, 1000, 1050, 1100, 1150, 1400, 1450, 1500, 1600, 1650, 1750, 1800, 1850, 1900, 2000, 2050, 4000)) OR (areatype EQ 'PS' AND sub_area IN (0120, 0140, 0180, 0200, 0450, 0470)); /* Drop annual observations */ IF m_ch_var NE 'M13'; /* Create numeric month variable from character var. */ FORMAT monthvar 2.; monthvar = SUBSTR(m_ch_var,2,2); unemprat = ser_var; LABEL monthvar = "Month"; LABEL year_var = "Year"; LABEL unemprat = "Monthly county unemployment rate (NS)"; LABEL areacode = "BLS geographic identifier"; FORMAT areacode $8.; FORMAT t1 $5.; t1 = 10000 + sub_area; areacode = areatype || st_fips || SUBSTR(t1,2,4); DROP survtype meascode ser_var m_ch_var t1 areatype st_fips sub_area seasonal; /* Note: the specific series that we need (from the BLS site): LAUCN37001003 LAUCN37003003 LAUCN37005003 LAUCN37007003 LAUCN37009003 LAUCN37011003 LAUCN37013003 LAUCN37015003 LAUCN37017003 LAUCN37019003 LAUCN37021003 LAUCN37029003 LAUCN37031003 LAUCN37033003 LAUCN37037003 LAUCN37039003 LAUCN37041003 LAUCN37043003 LAUCN37053003 LAUCN37055003 LAUCN37059003 LAUCN37061003 LAUCN37069003 LAUCN37073003 LAUCN37075003 LAUCN37077003 LAUCN37079003 LAUCN37081003 LAUCN37087003 LAUCN37091003 LAUCN37093003 LAUCN37095003 LAUCN37099003 LAUCN37103003 LAUCN37105003 LAUCN37109003 LAUCN37111003 LAUCN37113003 LAUCN37115003 LAUCN37117003 LAUCN37119003 LAUCN37121003 LAUCN37123003 LAUCN37129003 LAUCN37131003 LAUCN37137003 LAUCN37139003 LAUCN37141003 LAUCN37143003 LAUCN37145003 LAUCN37147003 LAUCN37149003 LAUCN37151003 LAUCN37153003 LAUCN37163003 LAUCN37165003 LAUCN37167003 LAUCN37169003 LAUCN37173003 LAUCN37175003 LAUCN37177003 LAUCN37181003 LAUCN37183003 LAUCN37185003 LAUCN37187003 LAUCN37189003 LAUCN37191003 LAUCN37197003 LAUCN37199003 LAUPA37030003 LAUPA37052003 LAUPA37060003 LAUPA37065003 LAUPA37070003 LAUPA37075003 LAUPA37080003 LAUPA37085003 LAUPA37095003 LAUPA37100003 LAUPA37105003 LAUPA37110003 LAUPA37115003 LAUPA37140003 LAUPA37145003 LAUPA37150003 LAUPA37160003 LAUPA37165003 LAUPA37175003 LAUPA37180003 LAUPA37185003 LAUPA37190003 LAUPA37200003 LAUPA37205003 LAUPA37400003 LAUPS37012003 LAUPS37014003 LAUPS37018003 LAUPS37020003 LAUPS37045003 LAUPS37047003 */ PROC CONTENTS; PROC MEANS; PROC TABULATE NOSEPS; CLASS year_var monthvar; VAR unemprat; TABLE year_var*monthvar, unemprat*MEAN; RUN;