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
- /
- Analytics
- /
- Stat Procs
- /
- Followup Statistics?

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

02-07-2011 04:48 PM

I am still in the process of learning some of the fundamentals of SAS, and I am trying to automate as much as I can. If this question is answered in another thread, then I apologize.

Is it possible to do follow-up procedures based on the output of a previous statistical procedure? For example, say I run a PROC GLM. I want to run a PROC MEANS, however, only if specific*p* values returned from the PROC GLM is < .05.

How would I go about doing this? How do I get those probability values from the PROC GLM and then use them to inform the program whether or not to perform the following PROC MEANS?

Is it possible to do follow-up procedures based on the output of a previous statistical procedure? For example, say I run a PROC GLM. I want to run a PROC MEANS, however, only if specific

How would I go about doing this? How do I get those probability values from the PROC GLM and then use them to inform the program whether or not to perform the following PROC MEANS?

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

02-09-2011 12:36 PM

Hello Phero,

When you run Proc GLM, include the ODS statement to extract the p-values and the corresponding effects (variable names) from the appropriate ODS table. Then, after selecting the variables with p<0.05, you can pass them on to Proc MEANS.

~Olga

When you run Proc GLM, include the ODS statement to extract the p-values and the corresponding effects (variable names) from the appropriate ODS table. Then, after selecting the variables with p<0.05, you can pass them on to Proc MEANS.

~Olga

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

02-09-2011 12:45 PM

Thanks for the reply. I have seen a lot of people mention using the **ods trace on** statement, but to be honest, I haven't been entirely clear as to what the output is that I'm looking at. Is there a good place to start to figure out what and where to ODS tables are, with example code or a breakdown of what the table would be? As I said, I'm still kind of new to SAS, so I'm not used to variables being around that I haven't explicitly declared.

Thanks again for your help.

Thanks again for your help.

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

02-10-2011 11:40 AM

Every portion of the output has a corresponding ODS table name. Go to the documentation for GLM and find "ODS Table Names". Using the ODS OUTPUT statement, you can direct SAS to create data files for each desired table within the output. The example below creates the MA file for the Type 1 and 3 test statistics (plus p-values, etc.; with a separate record for type 1 and type 3), and the LS file for the least squares means. Note: the names on the left-hand side of the = come for the ODS Table Names; the names on the right-hand side of = are arbitrary. Using PRINT, you can see how SAS stores the values. With programming steps, you could then delete either the type 1 or type 3 record (depending on the hypothesis you cared about), and then continue with other procedures.

However, I don't know why you would want to use PROC MEANS here, considering that you can easily use the LSMEANS (or even MEANS) statements right in GLM.

data t;

input trt y;

datalines;

1 1

1 2

1 2

2 6

2 5

2 4

3 2

3 3

3 4

;

proc glm data=t;

ods output ModelANOVA=ma LSmeans=ls;

class trt;

model y = trt;

lsmeans trt;

run;

proc print data=ma;

proc print data=ls;

run;

However, I don't know why you would want to use PROC MEANS here, considering that you can easily use the LSMEANS (or even MEANS) statements right in GLM.

data t;

input trt y;

datalines;

1 1

1 2

1 2

2 6

2 5

2 4

3 2

3 3

3 4

;

proc glm data=t;

ods output ModelANOVA=ma LSmeans=ls;

class trt;

model y = trt;

lsmeans trt;

run;

proc print data=ma;

proc print data=ls;

run;

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

02-12-2011 04:48 PM

Thanks for your reply, that seems to help. I'm still fairly unsophisticated with ODS, so it looks like I've got some work ahead of me in learning all of the ins and outs, as it were.