Data : 4 variables....x, y, z1 and z2.
Objective plot x against y where z2=1 and plot x against y for z2=2 on the same graph. Also use z1 to label the data points on each plot.
x y z1 z2
1 2 a 1
2 4 b 1
3 5 c 1
4 9 a 2
5 4 b 2
6 8 c 2
data foo;
input x y z1 z2;
if (z2 eq 1) then line1=y;
if (z2 eq 2) then line2=y;
datalines;
1 2 a 1
2 4 b 1
3 5 c 1
4 9 a 2
5 4 b 2
6 8 c 2
;
run;
symbol1 v=dot i=join c=red;
symbol2 v=dot i=join c=blue;
proc gplot data=foo;
plot line1*x line2*x / overlay;
run;
But what if I already have he data in a sas dataset and there are multiple sub categories. Is an 'if then' statement in a separate data step the only way to go...in which caseI wil have to write multiple if then statements..and where is the label option in your code...