x cd /pub/data/bls_la/Tools; %let pgm=cnvt_lausmeric; filename pgm "&pgm..sas"; *---We access unemployment data for the state (Mo) for various geographic levels inc state, county, cbsa and city at the MERIC web site http://www.missourieconomy.org/indicators/laus/default.aspx . We select the most recent month *<====March 2009 ========= and generate the report as an online table. Then use the Download button to capture a CSV file version. We do minor editing of this file before uplading it to this archive for processing here. We plan to do this about twice a year - getting data as of March and September. ----*; %let mm=03; %let month=March; %let year=2009; filename in "/pub/data/bls_la/laus_meric_mo_&mm&year..csv"; libname bls_la '/pub/data/bls_la'; %let set=laus_meric_mo_&mm&year; data bls_la.&set(label="Bls unemployment data for MO areas for &month &year"); length SumLev $3 fipco $5 AreaName $64 LaborForce Employed Unemployed 8 UERate 4; infile in firstobs=4 dsd lrecl=512; informat laborforce employed unemployed comma. uerate percent. ; input Areaname -- uerate; uerate=uerate*100; format uerate 5.1; label uerate='Unemployment Rate'; retain Year "&year" Month "&mm"; if Areaname="United States" then SumLev='010'; else if index(areaname,' County') or areaname='St. Louis City' then do; Sumlev='050'; length _aname $32; if areaname ne 'St. Louis City' then _aname=substr(areaname,1,length(areaname)-7); else _aname=areaname; fipco=put(_aname,$monamef.); end; else if areaname="Missouri" then do; fipco='29 '; sumlev='040'; end; else if scan(trim(areaname),-1,' ') in ('(city)','City') then Sumlev='160'; else if scan(trim(areaname),-2,' ')='In' then Sumlev='155'; else if index(areaname,'Statistical Area') then SumLev='381'; else if index(areaname,'Combined Stat') then SumLev='331'; else put areaname ' could not be assigned a sumlev code'; drop _: ; run; proc print data=bls_la.&set; id areaname; title "bls_la.&set"; run;