PROC IMPORT OUT= WORK.totpop DATAFILE= "D:\Age_sex.xls" DBMS=EXCEL2000 REPLACE; RANGE="totpop$"; GETNAMES=YES; RUN; data totpop; set totpop; race = "ALL"; run; proc print; run; proc freq order=data; tables age * sex ; weight US_POP; title "AGE-SEX DISTRIBUTION FOR US 2000 CENSUS"; run; proc freq order=data; tables age * sex ; weight MI_POP; title "AGE-SEX DISTRIBUTION FOR MICHIGAN 2000 CENSUS"; run; proc freq order=data; tables age * sex ; weight CO_POP; title "AGE-SEX DISTRIBUTION FOR ALLEGAN COUNTY 2000 CENSUS"; run; data TOTPOP2; set TOTPOP; POPULATION = US_POP; Unit = "UNITED STATES"; output; POPULATION = MI_POP; Unit = "MICHIGAN"; output; POPULATION = CO_POP; Unit = "COUNTY"; output; keep age sex unit population; run; proc print; title "Long Data Set to Compare Governmental Units"; run; proc freq data=totpop2 order=data; Where unit in ("MICHIGAN","COUNTY"); tables sex*age*unit / expected chisq cellchisq norow nopercent; weight population; title "Comparison of Age Dist for Michigan vs. Allegan Co"; run;