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(
- Since all base datasets share identical geography (7016 entities) see the key geographic variables for dataset acs2005.geography for
values of SumLev and various geographic codes.
- Variable names for the cell counts are the table name (same as the set name) followed by i and the line number
within the table.
- The width of the confidence interval for each table item is stored in variable Marg. If the first cell
in the table is a table
total then items after the first will have a related percentage variable named Pct. The value of this variable is
derived by taking the item value as a percentage of the table total (first item in table).
- Remember that all tables have a household-population-only restriction on the universe. Group Quarters were not covered in
the 2005 ACS.
- By far the easiest way to access these data are via the American FactFinder application at the Census Bureau web site.
),
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(
- This dataset has rows containing data from multiple base tables, as well as complete geographic header items.
- There are no confidence interval (marg) or derived percent (pct) variables on this dataset. To access that data you need to go to
the basetabs dataset for the table (or AFF to get MOE data).
- Because of the large number of variables stored in this dataset you need to be careful when extracting to a CSV file and
expecting to open that file with Excel, which has a 255 column limit.
- Variable names for the cell values are the table name (e.g. b01001 or c25123) followed by the letter i
and the line/cell number
within the table. b19202ci1 (for example) is the 1st cell in table b19202c, which is a Wave 2 B table.
- Remember that all tables have a household-population-only restriction on the universe. Group Quarters were not covered in
the 2005 ACS.
- In many cases the easiest way to access these data are via the American FactFinder application at the Census Bureau.
),
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(- To be included on this dataset a geographic entity must have a population of at least 65000.
- This dataset can be easily merged with any of the base tables. The dataset keys are sumlev and geoid by which this and
all the base datasets are sorted.
- The geoid variable is the unique geographic code provided by the Bureau. It includes geographic component as well as the
geographic area.
),
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(-- We say most Wave 1 B tables because some tables went to prtables or
imtables and are not included here.
- See what tables are Wave 1 in 2005 ACS Users Guide page, referenced below. Wave 1 are those released Aug. 15, 2006
),
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(-- We say most Wave 2 B tables because some tables went to prtables or
imtables and are not included here.
- See what tables are Wave 2 in 2005 ACS Users Guide page, referenced below. Wave 2 are those released Aug. 29, 2006
),
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(-- We say most Wave 2 B tables because some tables went to pwtables or prtables or
imtables and are not included here.
- Tables that are summaries by place-of-work geography are NOT contained in this dataset - they are in pwtables.
- See what tables are Wave 2 in 2005 ACS Users Guide page, referenced below. Wave 2 are those released Aug. 29, 2006
),
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(-- Has many fewer geographic levels than other base table combo sets because fewer areas qualify as
place of work tabulation areas. All these tables were released as part of Wave 3, i.e. there were no such tables in the other
2 waves.
),
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================== */