Reputation: 121
I'm trying to plot a data that looks something like this:
Year Test Mark
2000 98 0
2001 70 1
2002 80 0
2003 79 0
2004 80 0
2005 75 1
2006 77 1
2007 85 0
2008 90 0
2009 97 0
2010 90 0
2011 98 0
2012 96 0
2013 94 0
I would like to plot the year in x axis, test score on the y, be able to join the points together and use different symbols for the binary 'mark' variable: 0 and 1.
Which proc procedure would let me do this?
Upvotes: 2
Views: 728
Reputation: 12465
Use PROC SGPLOT with a data attribute mapping (dattrmap=) data set. Specific a scatter plot to plot the points and a series plot to connect them.
data toPlot;
format Year Test best. Mark 1.;
input Year Test Mark ;
datalines;
2000 98 0
2001 70 1
2002 80 0
2003 79 0
2004 80 0
2005 75 1
2006 77 1
2007 85 0
2008 90 0
2009 97 0
2010 90 0
2011 98 0
2012 96 0
2013 94 0
;;
run;
/*Set the marker attrib (astrisk=0 circle=1)*/
data plotattr;
format ID $8.
VALUE 1.
markersymbol markercolor $32.;
input ID VALUE markersymbol $ markercolor $;
datalines;
abc 0 asterisk red
abc 1 circle green
;;
run;
ods html;
proc sgplot data=toPlot dattrmap=plotattr;
series x=year y=test;
scatter x=year y=test / group=mark attrid=abc;
run;
ods html close;
Produces this:
Upvotes: 2