* Required macros: 'srs', 'est_srs', and 'ratio'; * url for data in INFILE; filename uspop url 'http://webpages.uidaho.edu/~renaes/Data/uspop.csv'; data uspop; length State $ 15; infile uspop firstobs=3 dlm=','; input State $ TotalPop Section Pop18_24 PopGE18 Pop15_44 PopGE65 PopGE85 PctPov ; run; proc print; run; proc means sum; var pop18_24 totalpop; run; * take an SRS from the 50 states to use for both SRS and ratio estimations; %srs(frame=uspop,npop=50,n=16,sample=uspop_srs,seed=59373) ; proc print data = uspop_srs; run; * SRS estimation; %est_srs(sample=uspop_srs,npop=50,response=Pop18_24,param=total) ; * plot the 18 to 24 population against the total population for the 16 sampled states ; proc sgplot data = uspop_srs ; scatter y=pop18_24 x=TotalPop ; run ; * ratio estimation; %ratio(sample=uspop_srs,x=totalpop,response=pop18_24,tau_x=287002236, param=total,npop=50) ;