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/GRAPH and ODS Graphics
- /
- plot mean with std error

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-29-2013 03:06 PM

I am trying to take the mean of the log of a variable. There are some values of the variable which is 1. so the log value will be "0"(zero) value . then i am supposed to take the mean of all the values that contains some '0' too and plot against std error. so when i do proc means i get missing mean as well as std error . i am suppose to plot this mean of the log value of the variable with the std error. Can anyone please guide me to overcome this problem.

Accepted Solutions

Solution

04-29-2013
10:36 PM

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

Posted in reply to sas9

04-29-2013 10:36 PM

Your second step doesn't use the dataset named ds created in the first step. Try this instead

**data ds(keep =usubjid dose1);****set datax;****where dose > 0 ;****dose1 =log(dose);****run;**

**proc means data=ds ;****by usubjid;****var dose1;****output out =datax1 n=n mean=mean stderr=stderr;****run;**

PG

PG

All Replies

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

Posted in reply to sas9

04-29-2013 03:59 PM

I am not clear as to what your problem is exactly. Which of the following conditions apply to your case. You get missing values...

- in the log-transformed value because the value is <= 0
- in the mean because the log-transformed values are all missing
- in the std because the mean is missing or there is only one nonmissing value

PG

PG

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

Posted in reply to sas9

04-29-2013 05:43 PM

Thankx for reaching out to me. I do have logarithmic values of the variable as zero since there are some values of the variable which are 1 and when i take log(1) it gives me zero.further to that i take mean of the log value of the variable and st error . the mean as well as stderror comes as missing.

all i want to do is take the log of a variable and then plot mean of the log with the stderror.but the variable has some 1 values.

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

Posted in reply to sas9

04-29-2013 08:18 PM

I still don't understand the issue. Here are some data that have been log-transformed. The results of PROC MEANS are not missing. Can you modify my DATA step to mimic the data that you have? Or can you explain how your analysis is different ?

data A;

input x @@;

logX = log(x);

datalines;

0 1 2 3 4 5 4 0 3 2 1 2 3

;

proc means data=A mean std;

var logX;

run;

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

Posted in reply to Rick_SAS

04-29-2013 10:19 PM

Thank you Rick for getting back to me.

variable(dose) values are for example 1 1 1 1 1 1.5 1.6 ...

data ds(keep =usubjid dose);

set datax;

where dose ne . ;

dose1 =log(dose);

run;

when i do this where ever dose values are equal to 1 i get dose1 =0

i get a note in logafter i run that part of the code as "mathematical operations could not be performed "and there is "an invalid argument to function log".

then i did

proc means data =datax ;

by usubjid;

var dose1;

output out =datax1 n=n mean=mean stderr=stderr;

run;

the datax1 dataset has values where mean=o and std err=0 and also some values where stderr =missing.

Solution

04-29-2013
10:36 PM

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

Posted in reply to sas9

04-29-2013 10:36 PM

Your second step doesn't use the dataset named ds created in the first step. Try this instead

**data ds(keep =usubjid dose1);****set datax;****where dose > 0 ;****dose1 =log(dose);****run;**

**proc means data=ds ;****by usubjid;****var dose1;****output out =datax1 n=n mean=mean stderr=stderr;****run;**

PG

PG

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

Posted in reply to PGStats

04-30-2013 10:57 AM

Thank you.. your idea of >0 removed the log problem.

I did use the correct dataset in my program but i guess typed it wrong in the sample code that i sent. I am sorry .Thank you very much though.