x cd /pub/data/acs2005/Tools; %let pgm=invoke_dosets; filename pgm "&pgm..sas"; /*--Invoke the %doset macro to create observations in the Datasets dataset for this directory. J. Blodgett, OSEDA, Jul., 2003 8/15/06: 2005 Wave 1 datasets. 3/05/07: Redoing after a major change in how we combined datasets in combine_base_tables2.sas . -- */ title "Job to Invoke doset Macro for Sets in acs2005, creating acs2005.datasets"; libname acs2005 '/pub/data/acs2005'; libname basetabs '/pub/data/acs2005/basetabs'; *-----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=acs2005,debug=1); %**doset(mode=initialize, libname=basetabs,filetype=acs2005,debug=1); *----------------------------------------------------------------------; /* =======================Begin comment================ %doset(mode=,libname=basetabs,filetype=acs2005, memname=_template_base, geouniv=UnitedStates, units=US state county place mcd cd109 puma cbsa etc, Years=2005, CreatePgm=read_base_tables, Description=%nrbquote(One of the Wave 1 base tables as defined for ACS 2005. Has all geographic areas with variables for just this single table. Includes confidence interval measures and percentages.), DataSource=%str(U.S. Bureau of the Census. Raw data from embargoed web site downloaded 8-12-06), SortedBy=SumLev geoid, UsageNotes=%nrbquote( ), URLMeta=%str(http://www.census.gov/acs/www/Products/users_guide/index.htm), SubType=base, debug=1); %doset(mode=,libname=basetabs,filetype=acs2005,template=_template_base, memname=b01001,description=SEX BY AGE, setgroup=b) %doset(mode=,libname=basetabs,filetype=acs2005,template=_template_base, memname=b01001a,description=%nrbquote(SEX BY AGE (WHITE ALONE)), setgroup=b) *---this macro will cause doset to be invoked for each of the 300+ base tables----; %macro gendoset; data _null_; set acs2005.tables end=last; _setparm='setxxx'; _descparm='descxxx'; _sfx=left(put(_n_,3.)); substr(_setparm,4)=_sfx; substr(_descparm,5)=_sfx; *<---these are the names of the global parms to be defined-; call symput(_setparm,trim(lowcase(table_id))); call symput(_descparm,trim(Table_title)); if last then call symput('nsets',left(put(_n_,3.))); run; %put _global_; %local i setg descrip; %do i=1 %to &nsets; %let descrip=&&desc&i; %let setg=%lowcase(%substr(&&set&i,1,1)); %doset(libname=basetabs,filetype=acs2005,template=_template_base, memname=&&set&i, description=%nrbquote(&descrip), setgroup=&setg ); %put *** doset macro invoked for &&set&i &descrip ***; %end; %mend gebdoset; %***gendoset ; ======================End comment================== */ *--------Here we do entries for the combined (merged) set collection in acs2005.----; %doset(mode=,libname=acs2005,filetype=acs2005, memname=_template_comb, geouniv=UnitedStates, units=US state county place mcd cd109 puma cbsa etc, Years=2005, CreatePgm=combine_base_tables2, DataSource=%str(U.S. Bureau of the Census. Created by merging data in basetabs subdir.), SortedBy=geocomp SumLev geoid, IndexedBy=State | Sumlev, keyvars=geocomp sumlev state county cbsa placefp, keyquals= | | | | | state, keyfmats=geocomp sumlev state county cbsa fplace, UsageNotes=%nrbquote( ), URLMeta=%str(http://www.census.gov/acs/www/Products/users_guide/index.htm), SubType=combined, debug=1); %doset(mode=,libname=acs2005,filetype=acs2005, memname=_template_meta, SubType=meta, sortprio=8) %doset(mode=,libname=acs2005, memname=geography, geouniv=UnitedStates, units=US state county place mcd cd109 puma cbsa etc ua necta school, Years=2005, CreatePgm=geography, Keywords=ACS base geography, Description=%nrbquote(Contains detailed descriptions of the geographic entities covered by the 2005 base tables. A population threshold of 65,000 was required for inclusion on this dataset.), keyvars=SumLev geocomp state county placefp cbsa metrodiv csa ua school, keyfmats=SumLev geocomp state county fplace cbsa metrodiv csa uauc2k school, keyquals=| | | | state , keyidvars= | | | | | | | | | areaname, SortedBy=geocomp sumlev geoid, DataSource=%str(U.S. Bureau of the Census. Data released starting Aug. 2006), UsageNotes=%nrbquote(), SubType=geo, sortprio=1, debug=0); %doset(mode=,libname=acs2005,template=_template_comb, memname=btables1, description=%nrbquote(Most Wave 1 B Tables for all US geographic areas), usagenotes=%nrbquote(-), varset=tablevars, sortprio=2, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=btables2, description=%nrbquote(Most Wave 2 B Tables for all US geographic areas), usagenotes=%nrbquote(-), varset=tablevars2, sortprio=2, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=btables3, description=%nrbquote(Most Wave 3 B Tables for all US geographic areas), usagenotes=%nrbquote(-), varset=tablevars3, sortprio=2, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=ctables1, description=%nrbquote(All Wave 1 C ("collpased") Tables for all US geographic areas), sortprio=2, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=ctables2, description=%nrbquote(All Wave 2 C ("collpased") Tables for all US geographic areas), sortprio=2, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=ctables3, description=%nrbquote(All Wave 3 C ("collpased") Tables for all US geographic areas), sortprio=2, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=pwtables, description=%nrbquote(All Wave 3 Place-of-Work tables for all US work areas), UsageNotes=%nrbquote(-), sortprio=3, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=prtables, geouniv=Puerto Rico, description=%nrbquote(Contains all the PR-specific base tables (those with a "pr" suffix in the name) for Puerto Rico only), sortprio=7, debug=0) %doset(mode=,libname=acs2005,template=_template_comb, memname=imtables, keyvars=geocomp sumlev state , keyquals=, keyfmats=geocomp sumlev state , description=%nrbquote(Combines all the b99 tables dealing with imputation), sortprio=8, debug=0) ; *------acs2005 metadata datasets-------------------*; %doset(mode=,libname=acs2005,template=_template_meta, memname=basetables, description=Metadata where each row describes one base table. All table types and all 3 waves, units=Base tables, usagenotes=%nrbquote(This is the result of merging and enhancing the other 3 table metadata sets.), debug=0); %doset(mode=,libname=acs2005,template=_template_meta, memname=profilevars, description=%str(Metadata describing the variables in the profile tables stored in the profiles subdirectory.), units=Profile table variables, debug=0); %doset(mode=,libname=acs2005,template=_template_meta, memname=tablevars, description=%str(Metadata describing the variables in the Wave 1 base tables.), units=Wave 1 base table variables, debug=0); %doset(mode=,libname=acs2005,template=_template_meta, memname=tablevars, description=%str(Metadata describing the variables in the Wave 1 base tables.), units=Wave 1 base table variables, debug=0); proc sort data=acs2005.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 acs2005.datasets (Sorted by SortPrio)'; run ; %gendshtm(libname=acs2005,debug=1,runprocc=1); proc datasets library=acs2005 nolist; modify datasets; index delete dataset memname; index create dataset=(libname memname) / unique; index create memname; quit; /* =======================Begin comment================ proc sort data=basetabs.datasets out=bysortprio; by sortprio; run; proc datasets library=basetabs nolist; modify datasets; index delete dataset memname; index create dataset=(libname memname) / unique; index create memname; quit; options mprint msglevel=i; %gendshtm(libname=basetabs,debug=1,runprocc=1,memindex=0); ======================End comment================== */