x cd /wwwhome/uic/uicapps; %let pgm=xtabs3; filename pgm "&pgm..sas";
*----This is /wwwhome/uic/uicapps/xtabs3.sas -----;
*---Use the xtabs3t.sas module for testing purposes-------------------*;
%let date = 12/04/99; *<-- date last revised;
%let tester=kumar; *--normally use value of john --;
/* Maintenance history:
7-2x-97: Initial coding.
8-05-97: Add plain text option (fo=text).
8-07-97: Add noborder option as part of format parm.
8-11-97: lowcase value of st parm.
12-04-97: Added code to process mcd/cousub geocodes.
Added library libname stmt.
11-05-98: Minor cosmetic chages. bgcolor of table set to white. Spaces
added after "XP1." etc in headers.
03-03-99: Add ability to process telex geography. Need state and telex
parms. Also changing footer to ref oseda and mscdc.
*/
*---This www-accessible routine will write a Basic Tables profile based on
1990 stf3 data directly to stdout, i.e. back to the client browser--;
%let version=1.2;
%let topdir=/wwwhome/uic/uicapps;
%let tmp=&topdir/tmp;
*libname library '/mscdc/ciesin/mable/mable.sdl' access=readonly;
libname library '/mscdc/sasctlgs7' access=readonly;
options nonumber nodate nocenter;
options skip=0;
filename tstdin '/wwwhome/uic/uicapps/tstdin';
filename tstdout '/wwwhome/uic/uicapps/tstdout.html';
/* This is the old "manual" way to figure out where input/output came
from/went to ..... now we use a sysget function to let program
figure it out for itself ...
*/
%let parmsin=tstdin; *<---parsprms module references this file;
*let parmsin=stdin; *<---for running from html--;
%let fileout=tstdout;
*let fileout=stdout;
*--assign parmsin and fileout based on unix en var user--;
data _null_;
*--when this is run from http the unix env var $USER is not defined. But
it still works, since undefined is still not 'john' (now the value of parm, &tester)--;
user=sysget('USER'); put user=;
if user="&tester" then call symput('parmsin','tstdin');
else call symput('parmsin','stdin');
if user="&tester" then call symput('fileout','tstdout');
else call symput('fileout','stdout');
run;
%put &parmsin;
options mprint;
options linesize=120 pagesize=120 nocenter nodate;
*--these are parms for state county zip tract blkgrp pmsa msacmsa place mcd;
%global st co zi tr bg ms pm pl mc te;
%global stfips;
%global fo; *--format of output: htlm or text-;
%global noborder;
%let parmnaml=2; *--parsprms routine checks this global parm and limits
length of parsed parmnames to this length. So user can specify
"zi" or "zip" or "zipcode" and they all come out just "zi".--;
%include '/wwwhome/uic/uicapps/parsprms.sas';
%put _global_; *<---displays the parms after parsing step--;
*--Following code adapted from sascode(xtmostat)--;
%put ***** xtabs3 in uicapps, Revised 12-4-97 (C) -- loaded for work ****;
*-----------------------****************-----------------;
%let title1 =Urban Information Center, U. of Missouri St. Louis;
%let title2 =1990 STF 3 Standard Extract Report - Basic Tables;
*--use macro to check type of st parm (alpha or numeric). convert alpha to
numeric (postal abbrev to fips) if necessary.--;
%macro ckit;
%if %qupcase(&st)=%quote(OR) %then %let st=41; %*--avoid problem with or for oregon-;
%let st=%lowcase(&st);
%if ak le &st and &st le wy %then %let stfips=%stcnvt(&st);
%else %do;
%let stfips=&st; %let st=%stcnvt(&stfips);
%end;
%mend ckit;
%ckit
%put stfips=&stfips st=&st;
*--data step to analyze the parms and point to the correct observation on the
correct sas data set--;
data dum(keep=state);
length state stab $2;
length fo $5 format $4; retain fo "&fo ";
length _errmsg $120 where where2 $64;
retain state "&stfips" stab "&st";
if verify(state,'0123456789') then do;
*--user specified a fips code instead of a postal abbrev. switch them-;
_save=state; state=stab; stab=_save;
end;
stab=lowcase(stab);
if fo="html2" then call symput('noborder','no'); *<--html2 is html table
but without borders--;
if fo =" " or upcase(fo)=:'H' then format='html'; else format='text';
if length("&pl ") eq 5 then do;
length _arg7 $7 _cenplac $4; _arg7=state||"&pl";
_cenplac=put(_arg7,$fplccnv.);
if _cenplac=' ' then
_errmsg='FIPS place code not found in convert table';
place=_cenplac;
end;
*--new code for mcd processing, 12.97--;
if length("&mc") eq 5 then do;
length _mcdarg $10 _cenmcd $3; _mcdarg=state||"&co&mc";
_cenmcd =put(_mcdarg,$fmcdcnv.);
put _cenmcd=;
if _cenmcd =' ' then do;
_errmsg='FIPS MCD code not found in convert table. ';
end;
mcd=_cenmcd;
end;
*--set flags based on which parms were specified--;
st="&st " ne " ";
co="&co " ne " ";
zi="&zi " ne " ";
tr="&tr " ne " ";
bg="&bg " ne " ";
ms="&ms " ne " "; *--msa/cmsa--;
pm="&pm " ne " "; *--pmsa--;
pl="&pl " ne " ";
mc="&mc " ne " ";
te="&te " ne " ";
length state $2 cnty $3 county $5 tract $7 zip $5 place $4 metro $4 blkgrp $1;
retain county cnty "&co" tract "&tr" zip "&zi" place "&pl" metro "&ms" blkgrp "&bg";
retain mcd "&mc";
length telex $7; retain telex "&te";
if 0 Please check your parameter specifications and try again.';
put 'Invalid parms passed to xtabs3 Application
';
put 'Sorry, we are unable to process your request for a Basic Tables report';
put "
&errmsg ";
put '
'; run; options no$syntaxcheck; data _null_; abort; run; *--stop the whole thing--; %end; %mend ckforerr; %ckforerr options nomprint nosymbolgen; libname stf903x "&dir" access=readonly; *-------------------generate the report------------------------------*; data dum; file &fileout; **stdout; retain format "&format"; if format='html' then do; put 'Content-type: text/html'///; put '
'; end; length areaname $64; *<--allow for longer enhanced versions--; %macro genset; %if &sasdset=&st.telex %then %do; libname stf93xwc '/mscdc/data/stf903x/wcs.bystate' access=readonly; *--we need both these data libraries to resolve the view--; libname stf903wc '/mscdc/data/stf903/wcs.bystate' access=readonly; set stf93xwc.&sasdset ( %end; %else %do; set stf903x.&sasdset ( %end; %mend genset; %genset where=( &where )) dum(in=dummy); if _n_=1 and dummy and format='html' then do; put '
| ' /' XP1. GENERAL POPULATION | ' / '|||
| TOTAL PERSONS/PERCENT SAMPLED | ' /'' TOTPOP COMMA10. ' | ' /'' PCTSMPLD 9.1 '%' ' | ' /'' / ' |
| PER SQUARE MILE / LAND AREA | ' /'' POPPSQMI 10.2 ' | ' /'' LANDSQMI 10.2 ' | ' /'' / ' |
| FEMALES | ' /'' FEMALE COMMA10. ' | ' /'' PCTFEMAL 9.1 '%' ' | ' /'' / ' |
| LIVING IN RURAL AREAS/ON FARMS | ' /'' RURAL COMMA10. ' | ' /'' ONFARMS COMMA10. ' | ' /'' / ' |
| LIVING N FAMILIES/ALONE | ' /'' INFAMILY COMMA10. ' | ' /'' ALONE COMMA10. ' | ' /'' / ' |
| LIVING IN GROUP QUARTERS | ' /'' GROUPQTR COMMA10. ' | ' /'' PCTGQ 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP2. PERSONS BY RACE/HISPANIC | ' / '|||
| WHITE | ' /'' WHITE COMMA10. ' | ' /'' PCTWHITE 9.1 '%' ' | ' /'' / ' |
| BLACK | ' /'' BLACK COMMA10. ' | ' /'' PCTBLACK 9.1 '%' ' | ' /'' / ' |
| ASIAN & PACIFIC ISLANDER | ' /'' ASIANPI COMMA10. ' | ' /'' PCTASIAN 9.1 '%' ' | ' /'' / ' |
| AMERICAN INDIAN, ESK., ALEUT | ' /'' AMINDIAN COMMA10. ' | ' /'' PCTAMIND 9.1 '%' ' | ' /'' / ' |
| HISPANIC (ANY RACE) | ' /'' HISPANIC COMMA10. ' | ' /'' PCTHISP 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP3. PERSONS BY AGE | ' / '|||
| 0-4 / PCT / CUM PCT | ' /'' AGE0_4 COMMA9. ' | ' /'' PCT0_4 5.1 ' | ' /'' PCT0_4 6.1 ' | ' / '
| 5-9 | ' /'' AGE5_9 COMMA9. ' | ' /'' PCT5_9 5.1 ' | ' /'' PCT0_9 6.1 ' | ' / '
| 10-13 | ' /'' AGE10_13 COMMA9. ' | ' /'' PCT10_13 5.1 ' | ' /'' PCT0_13 6.1 ' | ' / '
| 14-17 | ' /'' AGE14_17 COMMA9. ' | ' /'' PCT14_17 5.1 ' | ' /'' PCT0_17 6.1 ' | ' / '
| 18-24 | ' /'' AGE18_24 COMMA9. ' | ' /'' PCT18_24 5.1 ' | ' /'' PCT0_24 6.1 ' | ' / '
| 25-34 | ' /'' AGE25_34 COMMA9. ' | ' /'' PCT25_34 5.1 ' | ' /'' PCT0_34 6.1 ' | ' / '
| 35-44 | ' /'' AGE35_44 COMMA9. ' | ' /'' PCT35_44 5.1 ' | ' /'' PCT0_44 6.1 ' | ' / '
| 45-54 | ' /'' AGE45_54 COMMA9. ' | ' /'' PCT45_54 5.1 ' | ' /'' PCT0_54 6.1 ' | ' / '
| 55-59 | ' /'' AGE55_59 COMMA9. ' | ' /'' PCT55_59 5.1 ' | ' /'' PCT0_59 6.1 ' | ' / '
| 60-64 | ' /'' AGE60_64 COMMA9. ' | ' /'' PCT60_64 5.1 ' | ' /'' PCT0_64 6.1 ' | ' / '
| 65-74 | ' /'' AGE65_74 COMMA9. ' | ' /'' PCT65_74 5.1 ' | ' /'' PCT0_74 6.1 ' | ' / '
| 75-84 | ' /'' AGE75_84 COMMA9. ' | ' /'' PCT75_84 5.1 ' | ' /'' PCT0_84 6.1 ' | ' / '
| 85 AND OVER | ' /'' AGE85_UP COMMA9. ' | ' /'' PCT85_UP 5.1 ' | ' /'100.0 | ' / '
| UNDER 20 | ' /'' AGE0_19 COMMA9. ' | ' /'' PCT0_19 5.1 ' | ' /'' / ' |
| 20-39 | ' /'' AGE20_39 COMMA9. ' | ' /'' PCT20_39 5.1 ' | ' /'' / ' |
| 40-64 | ' /'' AGE40_64 COMMA9. ' | ' /'' PCT40_64 5.1 ' | ' /'' / ' |
| 65 AND OVER | ' /'' AGE65_UP COMMA9. ' | ' /'' PCT65_UP 5.1 ' | ' /'' / ' |
| MEDIAN AGE | ' /'' MEDAGE 9.1 ' | ' /'' /' | ' / ' |
| ' / ' | |||
| ' /' XP4. HOUSEHOLDS BY SIZE | ' / '|||
| TOTAL HOUSEHOLDS/AVERAGE SIZE | ' /'' TOTHHS COMMA10. ' | ' /'' AVGHHSZ 10.2 ' | ' /'' / ' |
| 1 PERSON/1 PERSON OVER 65 | ' /'' HHS1 COMMA10. ' | ' /'' HHS1OV65 COMMA10. ' | ' /'' / ' |
| PCTHHS: 2 PERSONS / 3-4 / 5+ | ' /'' PCTHHS2 5.1 '%' ' | ' /'' PCTHHS3_ 6.1 '%' ' | ' /'' PCTHHS5_ 6.1 '%' ' | ' / '
| ' / ' | |||
| ' /' XP5. HOUSEHOLDS BY TYPE | ' / '|||
| FAMILIES/PCT OF ALL HOUSEHOLDS | ' /'' FAMILIES COMMA10. ' | ' /'' PCTFAMHH 7.1 '%' ' | ' /'' / ' |
| MARRIED COUPLES/PCT OF FAMILIES | ' /'' MCFAMS COMMA10. ' | ' /'' PCTMCFAM 9.1 '%' ' | ' /'' / ' |
| WITH OWN CHILDREN | ' /'' MCWCHILD COMMA10. ' | ' /'' PCTMCWCH 9.1 '%' ' | ' /'' / ' |
| FEMALE HOUSEHOLDER (NO HUSB) | ' /'' FEMHEAD COMMA10. ' | ' /'' PCTFEMHE 9.1 '%' ' | ' /'' / ' |
| WITH OWN CHILDREN | ' /'' FEMHEADC COMMA10. ' | ' /'' PCTFEMHC 9.1 '%' ' | ' /'' / ' |
| NON-FAMILY HOUSEHOLDS | ' /'' NONFHHS COMMA10. ' | ' /'' PCTNFHHS 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP6.HOUSEHOLD INCOME 1989 | ' / '|||
| LESS THAN $10,000/PCT/CUM PCT | ' /'' HHI0_10 COMMA9. ' | ' /'' PHI0_10 5.1 ' | ' /'' PHI0_10 6.1 ' | ' / '
| $10,000 - $14,999 | ' /'' HHI10_15 COMMA9. ' | ' /'' PHI10_15 5.1 ' | ' /'' PHI0_15 6.1 ' | ' / '
| $15,000 - $24,999 | ' /'' HHI15_25 COMMA9. ' | ' /'' PHI15_25 5.1 ' | ' /'' PHI0_25 6.1 ' | ' / '
| $25,000 - $34,999 | ' /'' HHI25_35 COMMA9. ' | ' /'' PHI25_35 5.1 ' | ' /'' PHI0_35 6.1 ' | ' / '
| $35,000 - $49,999 | ' /'' HHI35_50 COMMA9. ' | ' /'' PHI35_50 5.1 ' | ' /'' PHI0_50 6.1 ' | ' / '
| $50,000 - $74,999 | ' /'' HHI50_75 COMMA9. ' | ' /'' PHI50_75 5.1 ' | ' /'' PHI0_75 6.1 ' | ' / '
| $75,000 - $99,999 | ' /'' HHI75_99 COMMA9. ' | ' /'' PHI75_99 5.1 ' | ' /'' PHI0_99 6.1 ' | ' / '
| $100,000 AND OVER | ' /'' HHI100UP COMMA9. ' | ' /'' PHI100UP 5.1 ' | ' /'100.0 | ' / '
| MEDIAN/AVERAGE | ' /'' MEDHHINC DOLLAR10. ' | ' /'' AVGHHINC DOLLAR10. ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP7.FAMILIES BY # WORKERS | ' / '|||
| COUNT/ AVG FAMILY INCOME 1989 | ' / '|||
| 0 WORKERS | ' /'' FAMWORK0 COMMA10. ' | ' /'' AVGFAMI0 DOLLAR10. ' | ' /'' / ' |
| 1 WORKER | ' /'' FAMWORK1 COMMA10. ' | ' /'' AVGFAMI1 DOLLAR10. ' | ' /'' / ' |
| 2 WORKERS | ' /'' FAMWORK2 COMMA10. ' | ' /'' AVGFAMI2 DOLLAR10. ' | ' /'' / ' |
| 3+ WORKERS | ' /'' FAMWORK3 COMMA10. ' | ' /'' AVGFAMI3 DOLLAR10. ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP8.OTHER INCOME MEASURES | ' / '|||
| MEDIAN/AVG FAMILY INCOME | ' /'' MEDFAMIN DOLLAR10. ' | ' /'' AVGFAMIN DOLLAR10. ' | ' /'' / ' |
| PER CAPITA INCOME/NON-GRP QTRS | ' /'' PCI DOLLAR10. ' | ' /'' PCIHHS DOLLAR10. ' | ' /'' / ' |
| PERSONS BELOW POVERTY LEVEL | ' /'' POOR COMMA10. ' | ' /'' PCTPOOR 9.1 '%' ' | ' /'' / ' |
| PERSONS BELOW 50% OF POVERTY | ' /'' VERYPOOR COMMA10. ' | ' /'' PCTVERYP 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP9.LEVEL OF EDUCATION | ' / '|||
| TOTAL PERSONS AGE 25+ | ' /'' AGE25_UP COMMA10. ' | ' /'' '100.0%' ' | ' /'' / ' |
| LESS THAN 9TH GRADE | ' /'' ELEMEDUC COMMA10. ' | ' /'' PCTELEM 9.1 '%' ' | ' /'' / ' |
| 9TH TO 12TH GRADE, NO DIPLOMA | ' /'' HIGHSCH1 COMMA10. ' | ' /'' PCTHSCH1 9.1 '%' ' | ' /'' / ' |
| HIGH SCHOOL GRAD. (OR EQUIV) | ' /'' HIGHSCH2 COMMA10. ' | ' /'' PCTHSCH2 9.1 '%' ' | ' /'' / ' |
| SOME COLLEGE, NO DEGREE | ' /'' COLLEGE1 COMMA10. ' | ' /'' PCTCOLL1 9.1 '%' ' | ' /'' / ' |
| ASSOCIATE/BACHELOR'S DEGREE | " /'' ASSTBACH COMMA10. ' | ' /'' PCTASSTB 9.1 '%' ' | ' /'' / ' |
| GRADUATE OR PROFESSIONAL DEGREE | ' /'' COLLEGE4 COMMA10. ' | ' /'' PCTCOLL4 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP10.UNEMPLOYMENT: CIV LAB FORCE | ' / '|||
| TOTAL CLF: UNEMPLOYED/RATE | ' /'' UNEMPLYD COMMA10. ' | ' /'' PCTUNEMP 9.1 '%' ' | ' /'' / ' |
| FEMALE: UNEMPLOYED/RATE | ' /'' UNEMPFEM COMMA10. ' | ' /'' PCTUNEMF 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XP11.OCCUPATION | ' / '|||
| TOTAL EMPLOYED PERSONS AGE 16+ | ' /'' EMPOVR16 COMMA10. ' | ' /'' '100.0%' ' | ' /'' / ' |
| MANAGER. & PROF. SPECIALTY OCCS | ' /'' MGRPROF COMMA10. ' | ' /'' PCTMGPR 9.1 '%' ' | ' /'' / ' |
| TECH, SALES, ADMIN. SUPPORT | ' /'' TECHSADM COMMA10. ' | ' /'' PCTTECHS 9.1 '%' ' | ' /'' / ' |
| SERVICE OCCUPATIONS | ' /'' SERVOCCS COMMA10. ' | ' /'' PCTSERV 9.1 '%' ' | ' /'' / ' |
| FARM, FORESTRY, FISHING | ' /'' FARMETC COMMA10. ' | ' /'' PCTFARME 9.1 '%' ' | ' /'' / ' |
| ALL OTHERS | ' /'' OTHEROCC COMMA10. ' | ' /'' PCTOTHOC 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' 'XH1. GENERAL HOUSING UNITS | ' /'|||
| TOTAL UNITS/ OCCUPIED UNITS | ' /'' TOTUNITS COMMA10. ' | ' /'' OCCUNITS COMMA10. ' | ' /'' / ' |
| % UNITS: OWNER OCC/RENTED/VACANT | ' /'' PCTOWNER 5.1 '%' ' | ' /'' PCTRENTR 6.1 '%' ' | ' /'' PCTVACNT 6.1 '%' ' | ' / '
| SINGLE-FAMILY UNITS | ' /'' UNITS1 COMMA10. ' | ' /'' PCTUNIT1 9.1 '%' ' | ' /'' / ' |
| IN BUIDINGS WITH 5+ UNITS | ' /'' UNITS5UP COMMA10. ' | ' /'' PCTUNIT5 9.1 '%' ' | ' /'' / ' |
| CONDOMINIUMS/MOBILE HOMES | ' /'' CONDOS COMMA10. ' | ' /'' MOBILHMS COMMA10. ' | ' /'' / ' |
| ' / ' | |||
| ' 'XH2. YEAR STRUCTURE BUILT | ' /'|||
| MEDIAN YR BUILT/DECADE MOST BUILT | ' /'' MEDYRBLT 8. ' | ' /'' BUILDDEC $9. ' | ' /'' / ' |
| BUILT IN BUSIEST DECADE | ' /'' NBUILTMD COMMA10. ' | ' /'' PCTBLTMD 9.1 '%' ' | ' /'' / ' |
| BUILT 1985-MARCH 1990 | ' /'' BUILTA85 COMMA10. ' | ' /'' PCTBLT85 9.1 '%' ' | ' /'' / ' |
| BUILT 1939 OR EARLIER | ' /'' BUILTP40 COMMA10. ' | ' /'' PCTBLT40 9.1 '%' ' | ' /'' / ' |
| ' / ' | |||
| ' /' XH3.HOUSING VALUES AND RENTS | ' / '|||
| SPEC. OWNER-OCC UNITS/AVG VALUE | ' /'' SPOWNUNT COMMA10. ' | ' /'' AVGHVAL COMMA10. ' | ' /'' / ' |
| UNITS PAYING CASH RENT/AVG RENT | ' /'' UNTSCRNT COMMA10. ' | ' /'' AVGRENT DOLLAR10. ' | ' /'' / ' |
| MEDIAN HOME VALUE/MEDIAN RENT | ' /'' MEDHVAL DOLLAR10. ' | ' /'' MEDRENT DOLLAR10. ' | ' /'' / ' |
| '
/ '
' / 'Under a contract with the Missouri Census Data Center '; PUT 'SOURCE: U.S. Bureau of the Census - 1990 Summary Tape File 3 ' / ' '; PUT ' ';
PUT ' |