/**********************************************************************/ /* define symbol characteristics */ symbol1 value=dot height=3 color=black interpol=rlclm90; /* produce the plot */ proc gplot data=fitness; plot heart*aero / frame; run; /**********************************************************************/ /* modify the horizontal axis */ axis1 label=('Oxygen Consumption' justify=center height=3.5 '(in milliliters per kilogram of body weight per minute)') major=(height=1.75) minor=(number=4 height=1); /* modify the vertical axis */ axis2 label=('Resting' justify=right 'Heart Rate') minor=(number=1 height=1) major=(height=1.25); /**********************************************************************/ title1 'Relation of Heart Rate to Oxygen Consumption'; /**********************************************************************/ footnote1 font=centx justify=left ' Produced by the Employee Fitness Committee' justify=right "&sysdate "; /**********************************************************************/ axis1 label=('Oxygen Consumption' justify=center height=3.5 '(in milliliters per kilogram of body weight per minute)') major=(height=1.75) minor=(number=4 height=1) length=50 pct origin=(15,) pct value=(height=3.5); /**********************************************************************/ axis2 label=(angle=90 'Resting Heart Rate') major=(height=1.25) minor=(number=1 height=1) value=(height=3.5) ; /**********************************************************************/ proc gplot data=fitness; note height=3.5 move=(66,45) pct 'Linear regression with' move=(66,40) pct '90% confidence limits' move=(66,35) pct 'for mean predicted values.'; plot heart*aero / haxis=axis1 vaxis=axis2 frame; run; /**********************************************************************/ goptions reset=all gunit=pct cback=white colors=(black) hsize=2.5 in vsize=3.5 in hpos=88 vpos=44 htitle=3.5 htext=3 ftitle=centx ftext=swiss border; /**********************************************************************/ footnote1 height=2.5 justify=left ' Linear regression with 90% confidence'; footnote2 height=2.5 justify=left ' limits for mean predicted values.'; footnote3 ' '; footnote4 font=centx justify=left height=2.5 ' Produced by the Employee Fitness Committee' justify=right "&sysdate "; /**********************************************************************/ note font=zapf move=(75,48) 'Mean production' move=(75,44) 'is 210,154' move=(75,40) 'kilowatt hours.'; /**********************************************************************/ note font=zapf move=(23,70) 'Mean production is' move=(23,65) '210,154 kilowatt hours.'; /**********************************************************************/ /* modify the midpoint axis */ axis1 label=none offset=(5,5); /* modify the response axis */ axis2 label=('Metric Tons' justify=right '(millions)') minor=(number=1); /* modify the group axis */ axis3 label=none; /* produce the chart */ proc gchart data=grainldr; vbar year / discrete group=country sumvar=amount coutline=black patternid=midpoint frame width=5 space=0 gspace=1 maxis=axis1 raxis=axis2 gaxis=axis3; run; /**********************************************************************/ /* modify the group axis */ axis3 value=('China' 'India' 'United States' 'Soviet Union') label=none; /**********************************************************************/ /* modify the group axis */ axis3 label=none order=('China' 'United States' 'India' 'Soviet Union'); /**********************************************************************/ /* define a format for the country names */ proc format; value $country 'CHN'='China' 'IND'='India' 'USA'='United States' 'USS'='Soviet Union'; run; /* produce the chart */ proc gchart data=grainldr; format country $country.; vbar year / discrete group=country sumvar=amount coutline=black patternid=midpoint frame maxis=axis1 raxis=axis2 gaxis=axis3; run; /**********************************************************************/ proc gchart data=grain90; format country $country.; pie country / sumvar=amount percent=outside slice=outside value=none coutline=black noheading ascending clockwise; run; /**********************************************************************/ proc gchart data=grainldr; format country $country.; vbar country / sumvar=amount subgroup=year ascending maxis=axis1 raxis=axis2 coutline=black frame; run; /**********************************************************************/ legend1 label=none position=(top center) offset=(,5) pct value=(height=5) shape=bar(4,4) pct; /**********************************************************************/ legend1 label=('People per' justify=left 'Square Mile'); /**********************************************************************/ value=('0 to 14.9' '15 to 24.9' '25 and higher') /**********************************************************************/ /* create the format */ proc format; value popfmt low-4='Fewer than 5' 5-20='5 to 20' 21-45='21 to 45' 46-high='More than 45'; /* modify the legend */ legend1 label=('People per' justify=left 'Square Mile' position=top) shape=bar(3,3) pct frame across=1 position=(right middle) offset=(-5,+18) pct; /* produce the map */ proc gmap map=maps.austral data=popdnsty; format popden popfmt.; id id; choro popden / discrete legend=legend1 coutline=black; run; /**********************************************************************/ proc gplot data=stocks (where=(year > 1979)); plot high*year low*year / overlay legend=legend1 haxis=axis1 vaxis=axis2 frame; run; /**********************************************************************/ /* modify the vertical axis */ axis2 order=(50 to 100 by 10) minor=(number=1 height=1) label=('Resting' justify=right 'Heart Rate') major=(height=1.25); /**********************************************************************/ /* define the format */ proc format; value ratefmt low-59='Below 60' 60-72='60 - 72' 73-80='73 - 80' 81-high='Over 80'; run; /* produce the chart */ proc gchart data=fitness; format heart ratefmt.; vbar heart / discrete freq maxis=axis1 raxis=axis2 coutline=black space=3; run; /**********************************************************************/ /* modify the horizontal axis */ axis1 order=(1952 to 1992 by 4) minor=(number=3) label=none length=80 pct; /* modify the vertical axes */ axis2 order=(0 to 3200 by 400) minor=(number=1) label=('Index'); /* define symbol characteristics */ symbol1 interpol=join font=marker value=C height=1.5; symbol2 interpol=join value=dot height=2; symbol3 interpol=none value=none; /* produce plot with right vertical axis */ proc gplot data=stocks; plot high*year low*year / overlay legend=legend1 haxis=axis1 vaxis=axis2 frame; plot2 high*year / haxis=axis1 vaxis=axis2; run; /**********************************************************************/ /* modify the vertical axes */ axis2 order=(400 to 3600 by 800) minor=(number=1) label=('Index') offset=(0,0); /**********************************************************************/ proc gchart data=fitness; vbar exer / discrete sumvar=heart type=mean ref=72 coutline=black width=5 maxis=axis1 raxis=axis2; note move=(60,62) pct 'Normal rate: 72'; run; /**********************************************************************/ proc gchart data=fitness; format heart 2.; vbar exer / discrete sumvar=heart type=mean mean coutline=black width=5 maxis=axis1 raxis=axis2; run; /**********************************************************************/ /* define symbol characteristics */ symbol1 value=dot height=2.5 interpol=rlclm90; /* explain the equation values */ footnote1 justify=left ' where HEART is resting heart rate' ' and AERO is oxygen consumption.'; /* produce plot */ proc gplot data=fitness; plot heart*aero / regeqn frame haxis=axis1 vaxis=axis2; run; /**********************************************************************/ /* modify the midpoint axis */ axis1 label=none; /**********************************************************************/ /* modify the response axis */ axis2 label=(justify=left 'Metric Tons' justify=left height=4 '(millions)') minor=(number=1); /**********************************************************************/ legend1 label=none shape=bar(4,4) pct value=('Corn' 'Rice' 'Wheat') origin=(45,15) pct mode=share; /**********************************************************************/ title1 'World Grain Production: 1990'; /**********************************************************************/ footnote1 justify=left font=zapf ' Source: UN Food and Agriculture Organization'; /**********************************************************************/ proc gchart data=grain90; format country $country.; hbar country / sumvar=amount subgroup=type ascending maxis=axis1 raxis=axis2 legend=legend1 coutline=black nostats frame; run; /**********************************************************************/ /* suppress the BY line */ option nobyline; /* sort the data set by the BY variable */ proc sort data=grainldr; by country; run; /* include the BY value in the title */ title1 'Grain Production for #byval(country)' justify=center '1989 and 1990'; /* produce the chart and name the BY variable */ proc gchart data=grainldr; format country $country.; by country; vbar year / discrete sumvar=amount group=type patternid=midpoint coutline=black frame width=5 maxis=axis1 raxis=axis2 gaxis=axis3; run; /**********************************************************************/