Table 2
SAS Code for Profile Plot Using Republican Vote Data
goptions reset=all goutmode=replace;
goptions htitle=1.0 ftitle=simplex htext=1.0 ftext=simplex;
data a;
input state $14. @16 y32 y36 y40 y60 y64 y68;
cards;
Missouri 35 38 48 50 36 45
Maryland 36 37 41 46 35 42
Kentucky 40 40 42 54 36 44
Louisiana 7 11 14 29 57 23
Mississippi 4 3 4 25 87 17
South Carolina 2 1 4 49 59 39
run;
data b; set a;
year=1932; vote=y32; output;
year=1936; vote=y36; output;
year=1940; vote=y40; output;
year=1960; vote=y60; output;
year=1964; vote=y64; output;
year=1968; vote=y68; output;
drop y32--y68;
run;
proc sort data=b;
by state year;
run;
proc gplot data=b;
title1 'Figure 1';
title3 'Percentage of People Voting Republican in Presidential Elections';
title5 'Profile Plot';
axis1 label=(a=90 'Percent of People Voting Republican')
width=1 major=(w=1) minor=(n=3 w=1)
order=0 to 100 by 20;
axis2 label=('Election Year')
width=1 major=(w=1) minor=none offset=(2)
order=1932 1936 1940 1960 1964 1968;
legend1 label=('State:') across=2;
plot vote*year=state / vaxis=axis1 haxis=axis2 legend=legend1
href=1932 1936 1940 1960 1964 1968 lhref=2;
symbol1 v=none i=join l=1 c=red w=1;
symbol2 v=none i=join l=2 c=red w=1;
symbol3 v=none i=join l=1 c=blue w=1;
symbol4 v=none i=join l=2 c=blue w=1;
symbol5 v=none i=join l=1 c=green w=1;
symbol6 v=none i=join l=2 c=green w=1;
run;
quit;
Table 3
SAS Code for Andrews Plot Using Republican Vote Data
data c; set a;
pi=3.14159265;
inc=2*pi/100;
do t=-pi to pi by inc;
f=y32/sqrt(2)+sin(t)*y36+cos(t)*y40+sin(2*t)*y60+cos(2*t)*y64+sin(3*t)*y68;
output;
end;
run;
proc gplot data=c;
title1 'Figure 2';
title3 'Percentage of People Voting Republican in Presidential Elections';
title5 'Andrews Plot';
axis1 label=(a=90 'f(t)')
width=&w major=(w=&w) minor=(n=1 w=&w)
order=-150 to 200 by 50;
axis2 label=('t')
width=&w major=(w=&w) minor=(n=1 w=&w)
order=-3.2 to 3.2 by 0.8;
legend1 label=('State:') across=2;
plot f*t=state / vaxis=axis1 haxis=axis2 legend=legend1;
symbol1 v=none i=join l=1 c=red w=1;
symbol2 v=none i=join l=2 c=red w=1;
symbol3 v=none i=join l=1 c=blue w=1;
symbol4 v=none i=join l=2 c=blue w=1;
symbol5 v=none i=join l=1 c=green w=1;
symbol6 v=none i=join l=2 c=green w=1;
run;
quit;
Table 4
SAS Code for Pinion Plot Using Republican Vote Data
data d; set a;
if state='Kentucky' then code=1;
if state='Louisiana' then code=2;
if state='Maryland' then code=3;
if state='Mississippi' then code=4;
if state='Missouri' then code=5;
if state='South Carolina' then code=6;
x=y32; y=y36; output;
x=y40; y=y60; output;
x=y64; y=y68; output;
code=7; x=y32; y=y36; output;
code=8; x=y40; y=y60; output;
keep state x y code;
run;
proc format;
value state 1='Kentucky' 2='Louisiana' 3='Maryland'
4='Mississippi' 5='Missouri' 6='South Carolina'
7='1932 vs 1936' 8='1940 vs 1960';
run;
proc gplot data=d;
title1 'Figure 3';
title3 'Percentage of People Voting Republican in Presidential Elections';
title5 'Pinion Plot';
axis1 label=(a=90 'Election Year 1936/1960/1968')
width=1 major=(w=1) minor=(n=3 w=1)
order=0 to 100 by 20;
axis2 label=('Election Year 1932/1940/1964')
width=1 major=(w=1) minor=(n=3 w=1)
order=0 to 100 by 20;
legend1 label=('State:') across=2;
plot y*x=code / vaxis=axis1 haxis=axis2 legend=legend1;
symbol1 v=none i=join l=1 c=red w=1;
symbol2 v=none i=join l=2 c=red w=1;
symbol3 v=none i=join l=1 c=blue w=1;
symbol4 v=none i=join l=2 c=blue w=1;
symbol5 v=none i=join l=1 c=green w=1;
symbol6 v=none i=join l=2 c=green w=1;
symbol7 v=dot i=none c=black;
symbol8 v=circle i=none c=black;
format code state.;
run;
quit;