x cd /pub/data/acs/Tools; %let pgm=invoke_dosets_basetbls; filename pgm "&pgm..sas"; *---NOTE: we use this setup only for the single year data now. No more 3-year and we have a separate module invoke_dosets_5yrs.sas to do the 5yr stuff ---; /*<=========================Comment out===================================== --Invoke the %doset macro to create observations in the Datasets dataset for a directory such as /pub/data/acsXXXX/basetbls , where XXXX is the acs vintage. J. Blodgett, OSEDA, Sept, 2014. Last revised: 11-25-13 to run with vintage 2012 3-year data. Last revised: 09-25-14 to run with vintage 2013 1-year data. Last revised: 10-27-14 to run with vintage 2013 3-year data. Last revised: 10-13-16 to run with vintage 2015 1-year data. %let year=2013; %let Gperiod=1; %let years=2013; %let Gperiod=3; %let years=%str(2011-2013); ===========================End commented out================================ */ %let year=2015; %let gperiod=1; %let years=2015; **** %str(2010-2014); title "Job to Invoke doset Macro for Sets in acs&year/basetbls, creating basetbls.datasets"; libname acs "/pub/data/acs&year"; libname basetbls "/pub/data/acs&year/basetbls"; ****proc sort data=nchsbri.datasets nodupkeys; *** by memname; *** run; %let libnameg=basetbls; %let todolist=; %let todo= ; *-----Run this step ONLY ONCE------------------------------------------; *----If you need to rerun (start over) then delete the datasets dataset first. doset will not allow initialize mode if the datasets set already exists.---; %***doset(mode=initialize, libname=basetbls,debug=1); *----------------------------------------------------------------------; options mprint; /*<=========================Comment out===================================== ===========================End commented out================================ */ *--Create templates for the 6 basic estimates and moe datasets, a pair for each 1, 3 and 5-yr periods--*; %doset(memname=_template_ustabs, filetype=acs~year, libname=basetbls, geouniv=%str(United States + PR), units=%nrbquote(Nation State County etc.), Years=%str(~year), CreatePgm=process_basetabs1yr, Description=%nrbquote(Base tables estimates for ~topic_list . ~period.-year estimates, vintage ~year..), keyvars=sumlev geocomp state county placefp cbsa ua, keyquals=%str(| | | | state | |), keyfmats=sumlev geocomp state county place cbsa ua, DataSource=%str(U.S. Bureau of the Census), SortedBy=State geoid, UsageNotes=%nrbquote(), SubType=~topicgrp, SetGroup=1yrEstimates, VarSet=, URLMeta=%str(https://mcdc.missouri.edu/pub/data/acs&year/basetbls/ACS&year._1-Year_TableShells.xls) ); %doset(memname=_template_usmoes, filetype=acs~year, libname=basetbls, geouniv=%str(United States + PR), units=%nrbquote(Nation State County etc.), Years=%str(~year), CreatePgm=process_basetabs1yr, Description=%nrbquote(Base tables margin-of-error data for ~topic_list . ~period.-year estimates, vintage ~year..), keyvars=sumlev geocomp state , keyfmats=sumlev geocomp state, DataSource=%str(U.S. Bureau of the Census), SortedBy=State geoid, UsageNotes=%nrbquote(), SubType=~topicgrp, SetGroup=1yrmoes, VarSet=, URLMeta=%str(https://mcdc.missouri.edu/pub/data/acs&year/basetbls/ACS&year._1-Year_TableShells.xls) ); %***doset(memname=_template_ustabs3yr, filetype=acs~year, libname=basetbls, geouniv=%str(United States + PR), units=%nrbquote(Nation State County etc.), Years=%str(~years), CreatePgm=process_basetabs3yr, Description=%nrbquote(Base tables estimates for ~topic_list . ~period.-year estimates, vintage ~year..), keyvars=sumlev geocomp state county placefp cbsa ua, keyquals=%str(| | | | state | |), keyfmats=sumlev geocomp state county place cbsa ua, DataSource=%str(U.S. Bureau of the Census), SortedBy=State geoid, UsageNotes=%nrbquote(), SubType=~topicgrp, SetGroup=3yrEstimates, VarSet=, URLMeta=%str(https://mcdc.missouri.edu/pub/data/acs&year/basetbls/Varlabs) ); %***doset(memname=_template_usmoes3yr, filetype=acs~year, libname=basetbls, geouniv=%str(United States + PR), units=%nrbquote(Nation State County etc.), Years=%str(~years), CreatePgm=process_basetabs3yr, Description=%nrbquote(Base tables margin-of-error data for ~topic_list . ~period.-year estimates, vintage ~year..), keyvars=sumlev geocomp state , keyfmats=sumlev geocomp state, DataSource=%str(U.S. Bureau of the Census), SortedBy=State geoid, UsageNotes=%nrbquote(), SubType=~topicgrp, SetGroup=3yrmoes, VarSet=, URLMeta=%str() ); %macro doit(topicgrp,period); data _null_; retain tg "&topicgrp"; select(tg); when('00_07') tl='Basic demographics and Ancestry'; when('08') tl='Journey to work'; when('09_16') tl='Households, Families, misc social characteristics'; when('17_20') tl='Income and Poverty'; when('21_24') tl='Employment, Veteran status and related items'; when('25_27','25_28') tl='Housing, Grp Qtrs and Insurance coverage'; end; call symput ('topic_list',trim(tl)); stop; run; %put topicgrp=&topicgrp topic_list=&topic_list ; %local psfx; %if &period=3 %then %let psfx=3yr; %else %if &period=5 %then %let psfx=5yr; %else %let psfx=%str(); %doset(memname=ustabs&topicgrp&psfx.,template=_template_ustabs&psfx, filetype=acs&year, debug=1); %if &period=1 %then %let itbe=&topicgrp._moes; %else %let itbe=&topicgrp&psfx._moes; %doset(memname=ustabs&itbe,template=_template_usmoes&psfx, filetype=acs&year, debug=1); %mend doit; /*<=========================Comment out===================================== %doit(00_07,1) ; %doit (08,1); %doit (09_16,1); %doit (17_20,1); %doit (21_24,1); %doit (25_27,1); *<---used to be 27 with 28 topic tables added for vintage 2013---; %doit(00_07,&Gperiod.) ; %doit (08,&Gperiod.); %doit (09_16,&Gperiod.); %doit (17_20,&Gperiod.); %doit (21_24,&Gperiod.); %doit (25_28,&Gperiod.); ===========================End commented out================================ */ %doit(00_07,&Gperiod.) ; %doit (08,&Gperiod.); %doit (09_16,&Gperiod.); %doit (17_20,&Gperiod.); %doit (21_24,&Gperiod.); %doit (25_28,&Gperiod.); *--this was 25_28 for the 1yr data but reverts to 25_27 for the 3 and 5yr periods--; proc sort data=basetbls.datasets out=bysortprio; by sortprio; run; proc print data=bysortprio; by libname notsorted libpath ; id memname; var SortPrio SetGroup SubType VarSet URLmeta GeoUniv years ; title2 'Listing of Selected Fields from nchsbri.datasets (Sorted by SortPrio)'; run cancel; proc datasets library=basetbls nolist; modify datasets; index delete dataset memname; index create dataset=(libname memname) / unique; index create memname; quit; options mprint msglevel=i; %gendshtm(libname=basetbls,debug=1,runprocc=1);