10-06-2017 01:21 AM
As I copped to in an old SGF paper, I'm not adverse to "borrowing" from Robert Allison's amazing-and-ever-growing SAS dataviz collection. So, when the idea of trying to implement Robert's SAS/GRAPH-based Trends in U.S. refugee admissions chart with SGPANEL was floated, well, I just had to give it a shot. Results above, code below. Not a replica, admittedly. With his uniscaled-but-not-space-wasting y-axes, consistent color usage, floating country labels, custom x-axis labels at the top and bottom, etc., Robert's chart is far more nuanced. Still, the SGPLOT version may be good enough for many people's purposes, and doesn't require much work. So, which way to go probably boils down to an impact-vs-effort decision on your part (and which software you have access to!). Now, how about someone coughing up a SAS Visual Analytics-based version so we can complete the trilogy? :-)
* Fun w/SAS ODS Graphics: SGPLOT take on SAS/GRAPH-based "Trends in U.S. refugee admissions" chart Based on SAS/GRAPH chart at blogs.sas.com/content/sastraining/2017/10/03/trends-in-u-s-refugee-admissions/ Data sourced from wrapsnet.org/s/Graph-Refugee-Admissions-since-19759517.xls; *==> Step 1: Get Excel data, transform it from Excel chart structure to relational; proc import out=Admissions dbms=xls replace datafile ='/folders/myfolders/Graph+Refugee+Admissions+since+1975(9.5.17).xls'; getnames=no; range="FY 1975-2017$A10:K52"; data AdmissionsNorm(keep=year country refugees); array countries (8) $30. _temporary_ ("Africa" "Asia" "Europe" "Former Soviet Union" "Kosovo" "Latin American Caribbean" "Near East South Asia" "PSI"); array numrefugees (8) b c e f g h i j; set admissions; year=a; do sub=1 to 8; country=countries(sub); refugees=numrefugees(sub); output; end; *==> Step 2: Produce the paneled chart!; ods graphics / antialias height=14in width=8.5in; proc sgpanel noautolegend; title height=12pt "U.S. Refugee Admissions by Region"; title2 height=10pt "Fiscal Year 1975 through Aug 31, 2017 (FY ends Sep 30)"; panelby country / onepanel uniscale=column noheader columns=1 spacing=3; vbar year / response=refugees group=country transparency=.4; inset country / nolabel textattrs=(size=14pt) position=topright; colaxis display=(nolabel) grid valueattrs=(size=7pt) valuesrotate=vertical; rowaxis display=(nolabel) grid valuesformat=comma11. valueattrs=(size=7pt); refline (1975 to 2015 by 5) / axis=x; footnote height=8pt "Data source: Refugee Processing Center (wrapsnet.org/admissions-and-arrivals/)";
10-06-2017 04:28 PM
Nicely done, TC. You have specified UNISCALE=column. It is also useful to keep the default view so each cell y-axis is uniform, allowing visual comparison of the values. I like your usage of INSET for the class values suppressing the row header. Easier to read. I was happy to learn some data step coding using arrays, as used by you.
10-09-2017 03:19 PM
"Now, how about someone coughing up a SAS Visual Analytics-based version so we can complete the trilogy?"
Challenge accepted! I'll pull something in VA and share with the community