/* */ /* This file contains SAS commands to construct figures in */ /* */ /* "Relative Distribution Methods in the Social Sciences" */ /* by Mark S. Handcock and Martina Morris, */ /* Springer-Verlag, 1999, ISBN 0387987789 */ /* */ /* This requires version 1.0.1 of the reldist functions for SAS 7 */ /* or later. */ /* */ /* by Don Gensimore and Mark S. Handcock */ /* */ /* August 11, 2000 */ /* */ /* See the README file for details. */ /* See the documentation for the SPlus function for additional details */ /* */ /* We make no claims that the code given */ /* is as efficient as it could be, and we would be interested to learn */ /* of more efficient approaches. */ /* */ /* Other software is available from the Relative Distribution Website:*/ /* */ /* http://www.csde.washington.edu/~handcock/RelDist */ /* */ /* A link to the website is maintained by the publisher at: */ /* */ /* http://www.springer-ny.com/stats */ /* */ /* under the heading "Author/Editor Home Pages." */ /* The website contains descriptions of the variables */ /* and data file formats. */ /* */ OPTIONS COMPRESS=NO; options linesize=80; goptions reset=all gunit=pct cback=white colors=(black) rotate htitle=2.5 htext=2 ftext=hwpsl005 device=PSLEPSF gaccess=gsasfile gsfmode=append gsflen=80 gend='0A'x rotate=portrait vsize=7.5in gepilog='showpage ' '0A'x ; %inc 'reldist.sas'; libname d '.'; libname out '.'; filename gsasfile 'example.ps'; /* Determine the relative data and plot the relative density */ /* Store the relative data in "rel_dist" */ %reldist(ComparisonDataset=d.recent, ComparisonVariable=chpermwa, ComparisonWeight=wgt, ReferenceDataset=d.original, referenceVariable=chpermwa, ReferenceWeight=wgt, outputdataset=rel_dist, how=add, match=none, location=median, scale=IQR, graph=T, robust=F ) /* Determine the median-adjusted relative data and plot the relative density */ %reldist(ComparisonDataset=d.recent, ComparisonVariable=chpermwa, ComparisonWeight=wgt, ReferenceDataset=d.original, referenceVariable=chpermwa, ReferenceWeight=wgt, outputdataset=rel_dist, how=add, match=location, location=median, scale=IQR, graph=T, robust=F ) /* Determine the reverse median-adjusted relative data and plot the relative density */ /* This is done to assist in the calculation of the confidence */ /* intervals for the polarization statistics */ %reldist(ComparisonDataset=d.original, ComparisonVariable=chpermwa, ComparisonWeight=wgt, ReferenceDataset=d.recent, referenceVariable=chpermwa, ReferenceWeight=wgt, outputdataset=irel_dist, how=add, match=location, location=median, scale=IQR, graph=T, robust=F ) /* Calculate and print the polarization statistics and confidence intervals */ %calc_polarization(dataset=rel_dist,x=x,weight=xwgt,idataset=irel_dist) run;