# On constructing 95% confidence ellipses for bivariate data in SAS - help!!

#### scrofungulus4

##### New Member
Hi guys!

I would very much like to plot / sketch / graph a 95% confidence ellipse using base SAS for a small data set I have, of size 9.
I'm unsure of how to proceed. This is the two methods I tried to use without much success:

proc princomp DATA=scores OUT=scores1 COVARIANCE plot=((alpha=0.05)=(confidence=ellipse));
title 'Scores:';
VAR x y ;
RUN;

and

proc corr data=scores nomiss plots=scatter(ellipse=prediction alpha=0.05);
var x y;
run;

Anyone have any ideas? Also, if you know of another statement to add to any code to provide me with the individual c.i. for the two variables, I would greatly appreciate that as well.

Scrofungulus

#### jrai

##### New Member
The above procs should have worked. What error message did you get in logs?

#### scrofungulus4

##### New Member
that's the worst part = i got NONE! no error messages. this may be a foolish thing to say but i am still using sas 9.1.3. Do you think the problem could lie with my version? Maybe use 9.3 if i can get access to it?

#### jrai

##### New Member
Did you use: ods graphics on; before executing the code?

#### scrofungulus4

##### New Member
I did, to no avail... but fear not, for I have the answer!

OK, so first I transcribed everything in IML, so as to read it better with matrix notation etc. etc...
But, as previously mentioned, I am in the unfortunate position of having SAS 9.1.3 at home. So a bunch of stuff I used didn't work, also because I didn't have SAS/GRAPH license and stuff like that. But I found the following today, this requires a very late version of 9.2 or preferably 9.3 - which my university has. The procedure that can be used is proc sgplot, it's really nice with fairly nice graph output, and you can of course specify your level of significance, and there's a bunch of other graphs that it can also sketch, specialized box plots, histograms, scatterplots, etc.

Check it out, it worked for me!

#### scrofungulus4

##### New Member
O yeah, also I asked on how to obtain individual confidence limits - simply part of proc means which can also be run. i don't have it with me at the moment, but it should look something like

Code:
proc means data=scores means clt maxdec=4 fw=8 alpha=0.1;
var x y;
run;
So, if you, dear reader, ever want to use this, just make sure of the options in proc means help file - I think it's "clt" but can be wrong - it stands for confidence limits ___ something...

Hope it helps!