## How to Calculate LS Mean,95%CI and p-value.

Super Contributor
Posts: 276

# How to Calculate LS Mean,95%CI and p-value.

Hi All.

As i am regular user for Base SAS,SQL and Macros but i did't come across to Statistical procedures.

Today my client came up with me a report ,in that i need to show some statistical columns which are LS MEANS ,95%CI and p-value.

CLient requirement looks likes bellow..

ActlevelNmeanSDLS MEAN95 % CIp-value
HIGHxxxx.xxx.xxxxx.xx(xx.xx,xx.xx)x.xxxx
LOWxxxx.xxx.xxxxx.xx(xx.xx,xx.xx)x.xxxx
MODxxxx.xxx.xxxxx.xx(xx.xx,xx.xx)x.xxxx

Could you please provide sample code to get above statistics as i dod't have much time to go through the statistical procedures.

please use SASUSER.ADMIT dataset to generate above table then i can adopt that code for my original dataset.

Note :

Confidence Interval from the ANCOVA model.

\$=p-Value from the ANCOVA model.

Thanks &Regards.

Sanjeev.K

Super Contributor
Posts: 543

## Re: How to Calculate LS Mean,95%CI and p-value.

Hi.

so,I used sashelp.class (which is not suitable for what you want, but it will give you an idea);

proc glm data = sashelp.class;

class sex; *need to put your group variable in the class statement

model age = sex;

lsmeans sex/stderr cl;

run;quit;

Good luck!

Anca.

Super Contributor
Posts: 276

## Re: How to Calculate LS Mean,95%CI and p-value.

Hi Anca ..

thank you so much for your rply..

here i am attaching Admit Dataset. Could you please try on this.

and i have few quires on your provided solution..

>Is this values based on ANCOVA model ???

>Is this possible to get output dataset with these values ???

once again thank you for your response ..

Regards.

Sanjeev.K

Super Contributor
Posts: 543

## Re: How to Calculate LS Mean,95%CI and p-value.

So, here is for example one link that shows ANCOVA analysis with SAS:

http://www.stat.sc.edu/~hitchcock/crackersasexample.txt

and this one:

SAS/STAT(R) 9.2 User's Guide, Second Edition

What I need to know from you is what is your X (independent variable) and what is your Y (dependent variable)? I assume that your X is the ActLevel (as per the sasuser.admit data set).

But what is the Y?

What I mean is that you need to set up a (simple) model where the group variable is your X and you need a Y so you can conclude if there are differences in Y between the X's groups.

Anyway....

Yes, there are ways to output the results by using either ods statement or the output out...

Discussion stats
• 3 replies
• 691 views
• 3 likes
• 2 in conversation