turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- problem with output confidence interval using proc...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-26-2010 12:20 AM

Dear SAS users:

I am trying to calculate means and confidence intervals for multiple variables (e.g 38 variables), listed in a table as 38 columns. My sas code is attached below. Somehow, the means and std can be calculated and print in the window, but the output file (out=tmp) only shows the result for the first variable V1. I am hoping get some help to have the full table with all the variable in it.The output is as follows:

_TYPE_ _FREQ_ n mean stderr lclm uclm

0 96 96 2.701145833 0.038329101 2.625052948 2.777238719

Thanks

pharmpk

filename datain

'd:\ ......csv';

data fulldata;

infile datain DELIMITER=',';

input Prob V1 V2 V3 .....V38;

if prob EQ _blank_ THEN delete;

drop _blank_;

run;

Proc means data=fulldata alpha=0.05;

var V1 V2 V3 .....V38;

OUTPUT OUT=tmp N=n MEAN=mean STDERR=stderr LCLM=lclm UCLM=uclm;

run;

I am trying to calculate means and confidence intervals for multiple variables (e.g 38 variables), listed in a table as 38 columns. My sas code is attached below. Somehow, the means and std can be calculated and print in the window, but the output file (out=tmp) only shows the result for the first variable V1. I am hoping get some help to have the full table with all the variable in it.The output is as follows:

_TYPE_ _FREQ_ n mean stderr lclm uclm

0 96 96 2.701145833 0.038329101 2.625052948 2.777238719

Thanks

pharmpk

filename datain

'd:\ ......csv';

data fulldata;

infile datain DELIMITER=',';

input Prob V1 V2 V3 .....V38;

if prob EQ _blank_ THEN delete;

drop _blank_;

run;

Proc means data=fulldata alpha=0.05;

var V1 V2 V3 .....V38;

OUTPUT OUT=tmp N=n MEAN=mean STDERR=stderr LCLM=lclm UCLM=uclm;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

03-30-2010 01:51 PM

You are SO close.

The problem is that use used the option in the form "Mean = mean". Since there can be only one variable in the output table named "mean" you got the mean (and other statistics) only for the first variable.

There are two ways around this. The first is to specify list, as in

Mean = (mean1 mean2...). The second is to change the output line to

OUTPUT OUT=tmp N MEAN STDERRr LCLM/autoname;

The autoname option will produce an output data set with variables named mean_v1 mean_v2 etc.

Needless to say, the first way is rarely used anymore.

Cheers,

Jonathan

> Dear SAS users:

>

> I am trying to calculate means and confidence

> intervals for multiple variables (e.g 38 variables),

> listed in a table as 38 columns. My sas code is

> attached below. Somehow, the means and std can be

> calculated and print in the window, but the output

> file (out=tmp) only shows the result for the first

> variable V1. I am hoping get some help to have the

> full table with all the variable in it.The output is

> as follows:

>

> _TYPE_ _FREQ_ n mean stderr lclm uclm

> 0 96 96 2.701145833 0.038329101 2.625052948

> 2.777238719

>

> Thanks

>

> pharmpk

>

>

>

> filename datain

> 'd:\ ......csv';

>

> data fulldata;

> infile datain DELIMITER=',';

> input Prob V1 V2 V3 .....V38;

> if prob EQ _blank_ THEN delete;

> drop _blank_;

> run;

>

> Proc means data=fulldata alpha=0.05;

> var V1 V2 V3 .....V38;

> OUTPUT OUT=tmp N=n MEAN=mean STDERR=stderr LCLM=lclm

> UCLM=uclm;

> run;

The problem is that use used the option in the form "Mean = mean". Since there can be only one variable in the output table named "mean" you got the mean (and other statistics) only for the first variable.

There are two ways around this. The first is to specify list, as in

Mean = (mean1 mean2...). The second is to change the output line to

OUTPUT OUT=tmp N MEAN STDERRr LCLM/autoname;

The autoname option will produce an output data set with variables named mean_v1 mean_v2 etc.

Needless to say, the first way is rarely used anymore.

Cheers,

Jonathan

> Dear SAS users:

>

> I am trying to calculate means and confidence

> intervals for multiple variables (e.g 38 variables),

> listed in a table as 38 columns. My sas code is

> attached below. Somehow, the means and std can be

> calculated and print in the window, but the output

> file (out=tmp) only shows the result for the first

> variable V1. I am hoping get some help to have the

> full table with all the variable in it.The output is

> as follows:

>

> _TYPE_ _FREQ_ n mean stderr lclm uclm

> 0 96 96 2.701145833 0.038329101 2.625052948

> 2.777238719

>

> Thanks

>

> pharmpk

>

>

>

> filename datain

> 'd:\ ......csv';

>

> data fulldata;

> infile datain DELIMITER=',';

> input Prob V1 V2 V3 .....V38;

> if prob EQ _blank_ THEN delete;

> drop _blank_;

> run;

>

> Proc means data=fulldata alpha=0.05;

> var V1 V2 V3 .....V38;

> OUTPUT OUT=tmp N=n MEAN=mean STDERR=stderr LCLM=lclm

> UCLM=uclm;

> run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

03-30-2010 04:29 PM

We already answered this question for you

http://support.sas.com/forums/message.jspa?messageID=34175#34175

http://support.sas.com/forums/message.jspa?messageID=34175#34175