/*--This program was run on my (jgb) PC and was then uploaded to this Unix directory for easy public access. Request follows (came via e-mail 9-4-01). Requires tabulating data in the sf1.moagersexh set. (Edited to simplify the task a little -jgb) " No big hurry on this one, but I just tried to run the P12A-P12H tables from the moph sf1 file on Uexplore, but it won't fully load (probably because of size). Could you run a (report) for Stan Cowan at MO Dept. of Health? He needs Missouri population by age and race. He would like to have the number of people in age categories listed below, also broken down by race. He'd like Hispanic by age, too, but not broken down by race. Here are the age categories: age 0-39, age 40 and over age 50 and over age 60 and over age 70 and over age 80 and over Debbie " Strategy for handling this is simple: 1. Code a data step where we create 6 variables corresponding to the 6 requested age categories. We also keep the county, race and hispanic category variables. We filter those subtotals where race and hispanic are blank. 2. Use proc means to aggregate the 6 variables; we do this once by race using race as a class variable. On the 2nd proc means step we simply filter the input so that it only has to sum persons who reported they were of hispanic origin (so that the category variable Hispanic has a value of 1. --- */ /*---For the following libname statement to work, a statement of the form: %let mcdcsapw=xxxxxx; was submitted prior to this program to assign a value to the password global &mcdcsapw . --- */ libname sf12000 server=mcdc.mcdcshr sapw=&mcdcsapw; *<---reference the 2000 SF1 data on sas/share server.; filename pcpgm 'l:\SAS Tools\samppgms\sf1_agersexh_agg.sas'; *---create temporary data set with the six age counts---; data aggin; set sf12000.moagersexhng; *<---use the "ng" version since we do not need the geocodes. We just need a summary for the entire state.--; where race ne ' '; *<---filter out those obs without race and hispanic detail--; if age <40 then under40=persons; else over40 = persons; if age > 50 then over50 = persons; if age > 60 then over60 = persons; if age > 70 then over70 = persons; if age > 80 then over80=persons; keep race hispanic persons under40--over80; *<---note the "--" variable interval. These are all the new variables being created in the data step-; run; *--this step processed over 900,000 observations and took appx. 51 seconds to run.--; *--and now let proc means do the arithmetic for us--; title 'Persons in Selected Age Groups, State of Missouri'; title2 'Source: Summary File 1, 2000 Census (sf12000.agersexh)'; footnote 'Programming by the Office of Social and Economic Data Analysis'; options nodate linesize=100 pageno=1; proc means data=aggin sum maxdec=0; var under40--over80; class race ; title3 'Breakdown By Race'; run; proc means data=aggin (where=(hispanic='1')) sum maxdec=0; var under40--over80; title3 'Breakdown for Persons of Hispanic Origin'; run; *---Upload the program file to Unix. We save the code locally to the pcpgm file---; signon mcdc; rsubmit; proc upload infile=pcpgm outfile='/pub/data/sf12000/Tools/sf1_agersexh_agg.sas'; run; endrsubmit;