/* To run this program, download http://www.swivel.com/data_sets/spreadsheet/1007711; and save as "usincome.csv", and download http://www.swivel.com/data_sets/spreadsheet/1002243; and save as "usmortgage.csv". */ options ls=80; proc import datafile='usincome.csv' out=income; run; proc import datafile='usmortgage.csv' out=mortgage; run; proc sort data=mortgage(rename=Median=Mortgage); by State; run; proc sort data=income(rename=(U_S__State=State Annual_Income_per_capita=Income)); by State; run; data both; merge mortgage income; by State; run; title 'Median Mortgage Payment vs. Median Income'; proc gplot data=both; plot Mortgage * Income; run; data lbls; length function style $ 9 text $ 20; retain function 'label' xsys ysys '2' hsys '3' size 3 color 'blue' style 'helvetica' position '2'; set both; x = income; y = mortgage; text = left(state); run; title 'Median Mortgage Payment vs. Median Income'; proc gplot data=both; plot Mortgage * Income /annotate=lbls; run;