0
votes

I would like to make a bubble plot of two ordinal variables plotted against each other, with a loess line plotted trough it in SAS, could somebody help me with this?

More specific:

The two variables contain scores between 0 and 10. my data looks pretty much like this:

data dataset;
Obs var1 var2
1   0    4
2   3    2
3   3    2
4   2    5
5   6    9
6   7    9
7   1    7
8   7    9

What I'm doing right now is just making a scatterplot and drawing a loess line trough it, but since a scatterplot of this kind of data only gives you a roster-like graph, I would like to make a bubble plot out of it to represent the frequency of each case... (so in my example the bubbles in (3,2) and (7,9) would be a bit bigger than te rest)

Afterwards however I would like to still be able to draw that loess line trough it...

1

1 Answers

0
votes

Not exact but hopefully enough to get you started

data dataset;
input obs var1 var2;
cards;
1   0    4
2   3    2
3   3    2
4   2    5
5   6    9
6   7    9
7   1    7
8   7    9
;
run;

proc freq data=dataset noprint;
table var1*var2/out=data2;
run;

proc sgplot data=data2;
bubble x=var1 y=var2 size=count;
loess x=var1 y=var2;
run; quit;