x cd /pub/data/stf904/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, 12/2005
-- */
title "Job to Invoke doset Macro for Sets in stf904, creating stf904.datasets";
libname stf904 '/pub/data/stf904';
*-----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=stf904,debug=1);
*----------------------------------------------------------------------;
*<==========================TEMPLATEs====================================;
%doset(mode=,libname=stf904,
memname=_template_filea,
memlabel=,
geouniv=Missouri,
units=%str(Many, down to tract/BNA within metro area),
Years=1990,
CreatePgm=stf904c,
Keywords=1990 Summary Tape File 4,
keyvars=Slvl state county msacmsa placefp geocomp chariter,
keyfmats=Slvl state county metro fplace geocomp charitr,
keyquals=| | | | state ,
DataSource=%str(U.S. Bureau of the Census),
SortedBy=,
UsageNotes=%nrbquote(
- Watch out for geographic components. Use a filter of
geocomp Equals 00
if you do not want to not look at these special summaries.
),
SubType=,
SetGroup=moa,
SortPrio=4,
VarSet=variablesb,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/stf904/cb6308.all.pdf),
debug=0);
%doset(mode=,libname=stf904,
memname=_template_fileb,template=_template_filea,
geouniv=Missouri,
units=%str(Many, down to place of 2500 or more),
setgroup=mob,
VarSet=variablesb,
SortPrio=4,
debug=0);
%doset(mode=,libname=stf904,
memname=_template_filec,
geouniv=United States,
units=%str(US, State, County, Place (10,000+), Urbanized Area, etc),
Years=1990,
createpgm=cnvt_usfiles,
keyvars=sumlev geocomp state county msacmsa placefp urbarea,
keyquals= | | | | | state,
keyfmats=sumlev geocomp state county metro fplace urbarea,
UsageNotes=%nrbquote(
- Watch out for geographic components. Use a filter of
geocomp Equals 00
if you do not want to not look at these special summaries.
),
VarSet=variablesb,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/stf904/cb6308.all.pdf),
debug=0);
*<====================================A Table Files=====================================;
%doset(mode=,libname=stf904, template=_template_filea,
memname=filea_moatbls,
memlabel=%nrbquote(File A, Missouri A Tables),
Description=%nrbquote(Very detailed tabulations based on the 1990 census long form: for total population.),
UsageNotes=%nrbquote(- The fact that this is an A File indicates what kind of geographic summaries to expect.
The fact that the file contains A Tables indicates a specific set of summary tables that are presented just for the total
population (as distinguished from B Tables, which get repeated for a series of characteristic iterations)
- Watch out for geographic components. Use a filter of
geocomp Equals 00
if you do not want to not look at these special summaries.
),
SubType=atabs,
Varset=variablesa,
SetGroup=moa,
SortPrio=4,
debug=0);
%doset(mode=,libname=stf904, template=_template_fileb,
memname=fileb_moatbls,
memlabel=%nrbquote(File B, Missouri A Tables Summarizing Total Population),
Description=%nrbquote(Very detailed tabulations based on the 1990 census long form: for
Total Population (with geocomps)),
SubType=atabs,
Varset=variablesa,
SetGroup=mob,
SortPrio=4,
debug=0);
%doset(mode=,libname=stf904, template=_template_filec,
memname=usatbls,
memlabel=%nrbquote(File C, US A Tables),
Description=%nrbquote(Very detailed tabulations based on the 1990 census long form: A Tables for
Total Population (with geocomps)),
SubType=atabs,
Varset=variablesa,
SetGroup=us,
debug=0);
*<==============================B Tables files using a macro================================;
%macro btabs(iters,iternames);
%if %superq(iters) = %str() %then
%let iters=ami api bla whi oth tot his;
%if %superq(iternames) = %str() %then
%let iternames=American Indian and Alaskan Native:Asian and Pac Islndr:Black:White:Other:Total:Hispanic;
%let niter=0;
%let iter=%scan(&iters,1);
%do %while(&iter ne %str());
%let itername=%scan(&iternames,&niter,%str(:));
%put ****Begin generating B tables entries for chariter: &niter &iter &itername ;
%if iter=his %then %let unotes=%str(+ - Hispanic persons can be of any race.); %else %let unotes=;
%let unotes=&unotes
- The following table cells are missing from this dataset: HB17I4 to HB17I16 PB88CI4.;
%let unotes=&unotes
;
%doset(mode=,libname=stf904, template=_template_filea,
memname=filea_mobtb&iter,
memlabel=%nrbquote(File A, Missouri B Tables for &itername),
Description=%nrbquote(Detailed tabulations based on the 1990 census long form: for
the &itername population, Missouri File A),
UsageNotes=%nrbquote(&unotes),
SubType=btabs,
SetGroup=moa,
VarSet=variablesb,
URLMeta=,
debug=0);
%doset(mode=,libname=stf904, template=_template_fileb,
memname=fileb_mobtb&iter,
memlabel=%nrbquote(File B, Missouri B Tables for &itername),
Description=%nrbquote(Detailed tabulations based on the 1990 census long form: for
the &itername population, Missouri File B),
UsageNotes=%nrbquote(&unotes),
SubType=btabs,
SetGroup=mob,
VarSet=variablesb,
URLMeta=,
debug=0);
%if iter=his %then %let unotes=%str(Hispanic persons can be of any race.); %else %let unotes=;
%let unotes=+&unotes;
%doset(mode=,libname=stf904, template=_template_filec,
memname=usbtb&iter,
memlabel=%nrbquote(File C, U.S. B Tables for &itername),
Description=%nrbquote(Detailed tabulations based on the 1990 census long form: for
the &itername population, United States (File C)),
UsageNotes=%nrbquote(&unotes),
SubType=btabs,
Varset=variablesb,
SetGroup=us,
debug=0);
%if (&iter ne his) and (&iter ne tot) %then %do; %*---generate entries for each of the non-hispanic chariters---;
%put ****And now generating the non-hipsanic entries for &iter &itername;
%if &iter=ami %then %let iter1=i; %else %let iter1=%substr(&iter,1,1);
%if &iter ne ami and &iter ne api %then %do;
%doset(mode=,libname=stf904, template=_template_filea,
memname=filea_mobtb&iter1.nh,
memlabel=%nrbquote(File A, Missouri B Tables for &itername, non Hispanic),
Description=%nrbquote(Detailed tabulations based on the 1990 census long form: for
the &itername / non Hispanic population, Missouri File A),
SubType=btabs,Varset=variablesb,
SetGroup=moa,
debug=0);
%end;
%*---We were surprised to find that we did not have data for the non-hispanic chariter for mo fileb--;
%***doset(mode=,libname=stf904, template=_template_fileb,
memname=fileb_mobtb&iter,
memlabel=%nrbquote(File B, Missouri B Tables for &itername),
Description=%nrbquote(Detailed tabulations based on the 1990 census long form: for
the &itername / non Hispanic population, Missouri File B),
SubType=btabs,
SetGroup=mob,
debug=0);
%doset(mode=,libname=stf904, template=_template_filec,
memname=usbtb&iter1.nh,
memlabel=%nrbquote(File C, U.S. B Tables for &itername, non Hispanic),
Description=%nrbquote(Detailed tabulations based on the 1990 census long form: for
the &itername / non Hispanic population, United States (File C)),
UsageNotes=%nrbquote(&unotes),
SubType=btabs,Varset=variablesb,
SetGroup=us,
debug=0);
%end; %*--generating xxxnh dataset entries---;
%let niter=%eval(&niter+1);
%let iter=%scan(&iters,&niter);
%let itername=%scan(&iternames,&niter,%str(:));
%end; %*--of %do %while group---;
%mend btabs;
options NOmprint;
%btabs ();
*<===========================Other - the usgeos dataset=================;
%doset(mode=,libname=stf904,
memname=usgeos,universe=United States,
memlabel=%str(US geographic header fields only),
geouniv=United States,
units=%str(US, State, County, Place (10,000+), Urbanized Area, etc),
Years=1990,
createpgm=cnvt_usfiles,
keyvars=sumlev geocomp state county msacmsa placefp urbarea,
keyquals= | | | | | state,
keyfmats=sumlev geocomp state county metro fplace urbarea,
Description=%nrbquote(This dataset contains just the geographic identifier fields for the entire U.S..
stripped off the usatbls dataset.),
UsageNotes=%nrbquote(- Explore this dataset to explore and find out what geography is available
& what the various codes are.
It will be faster to extract from this dataset rather than from one that contains all the large tables.
- The variables SumLev, Geocomp and Geocode together form a unique key to the geographic area. Areaname, as usual,
contains the name of the area being summarized. Use these fields to link to data in the other A and B tables datasets since
they will contain the same values.
- The pop100 and hu100 variables contain the complete-count population and housing unit counts for the area.
- Variable County is stored as a 5-digit code but displays as a name using a SAS format code.
Similarly, MSACMSA is stored
as a 4-digit code but displays as the name of the metro area. You can override this with a Format spec in Dexter (sec. V-c)
such as:
county $5. msacmsa $4. .
- IntPtLng and IntPtLat are the lat/long coordinates of an internal point for the area. The longitude is
stored as a positive number, representing a west longitude.
- There is some uncertainty regarding the geocode variable for some of the American Indian/Alaskan Native geographies. Use
with caution.
),
URLmeta=%str(https://mcdc.missouri.edu/pub/data/stf904/stf904.cendicts.idvars),
SubType=geos,
SortPrio=1,
setgroup=us);
proc sort data=stf904.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 stf904.datasets (Sorted by SortPrio)';
run ;
proc datasets library=stf904 nolist;
modify datasets;
index delete dataset memname;
index create dataset=(libname memname) / unique;
index create memname;
quit;
%gendshtm(libname=stf904,debug=1,runprocc=1);