user17670
user17670

Reputation: 437

plot more than one confidence interval in one plot at a particular order[SAS]

I need to plot more than one confidence interval in one plot at a particular order.
For example, my data is:

N Est. Lower Upper
1  5    3     6
2  1    0     4
3  3    0     7

I use the following command to plot:

proc sgplot data=confidence;
scatter y=N x=est. / xerrorlower=lower xerrorupper=upper
      markerattrs=(symbol=circlefilled size=9);
run;

SAS will always plot the confidence interval at the order of N from 1 to 3. However, I need to show a trend of est. change. i.e the order I need is N=2 at first followed by N=3 and N=1 corresponding to est. = 1 3 5. Even after sorted by est., SAS still do the same things. I know I can sort and add an new order to my data to make the result I want, but I still want to show the correct N in my final plot to tell me the number of my confidence interval. Thanks.

Upvotes: 1

Views: 582

Answers (1)

SRSwift
SRSwift

Reputation: 1710

You can request a discrete vertical axis, and specify the ordering method using the yaxis statement:

yaxis discreteorder = data type = discrete;

This will tell SAS to ignore the values in N and display them based on the order in which they are read from the dataset. You will have to sort your data in advance.

Upvotes: 2

Related Questions