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
- /
- PROC GLIMMIX Profiling Using Divisor List

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-28-2015 10:05 AM

I would like to use Proc Glimmix to compare the difference in hospital effects between each hospital in my study and the average.

So basically I want to look at each Hospital (42 in total) and compare them with the average. Using the SAS documentation and a couple of online searches I have been able to get my code (simplified) to what is pasted below.

This gives me the OR and CL for one hospital. What I am uncertain of is how to be sure which hospital I am analyzing. In the example below, which hospital is HOSPITAL 41? And if I change it to 40, which is 40? How can I get SAS to include the Hospital ID in the output so I am absolutely sure which hospital is being reported on? Alternatively, how could I set this approach up to step through each Hospital and give me my results?

**Code:**

proc glimmix data = Analysis_vaginal_final;

class HOSPITAL;

model Y(event="1") = X / dist=BINARY link=LOGIT ddfm=BW solution;

random HOSPITAL / solution;

estimate 'HOSPITAL1 vs Avg' | HOSPITAL

41 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 / divisor=42 df=41 OR CL;

run;

**Desired Output:**

HOSPITAL | Relative Risk | P-Value |

01 | 1.01 | 0.27 |

02 | 0.75 | 0.81 |

03 | 1.55 | 0.04 |

… | … | … |

Accepted Solutions

Solution

04-28-2015
10:39 AM

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

Posted in reply to mikemangini

04-28-2015 10:39 AM

Hospitals are referenced by position (sorted by number or letter). A coefficient for each hospital in order. So your code is (almost) giving the difference between the first hospital and the average of the rest. However, your divisor should be 41. For the second hospital, you would write:

estimate '...' | hospital -1 41 -1 -1 -1 .....;

where the dots are for the remaining stuff, or remaining -1s. An estimate statement for each hospital.

All Replies

Solution

04-28-2015
10:39 AM

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

Posted in reply to mikemangini

04-28-2015 10:39 AM

Hospitals are referenced by position (sorted by number or letter). A coefficient for each hospital in order. So your code is (almost) giving the difference between the first hospital and the average of the rest. However, your divisor should be 41. For the second hospital, you would write:

estimate '...' | hospital -1 41 -1 -1 -1 .....;

where the dots are for the remaining stuff, or remaining -1s. An estimate statement for each hospital.

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

04-28-2015 10:51 AM

Thank you for your reply. This is very helpful. So the order is determined by how the input data set is already pre-sorted? So assuming my IDs are {1,2,...42}, I can step through sequentially?

So the next two iterations in order to get the ratios for hospital 2 and hospital 3 would be:

...

estimate 'Hospital2 vs Avg' | PRV_NUM

-1 41 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 / divisor=41 df=41 OR CL;

...

estimate 'Hospital3 vs Avg' | PRV_NUM

-1 -1 41 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 / divisor=41 df=41 OR CL;

I am fine with doing this 42 times, however, any way in PROC GLIMMIX to streamline this that you are aware of?

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

Posted in reply to mikemangini

04-28-2015 10:59 AM

Not sorted by data order. It will be sorted internally (1, 2, 3, etc.). Look at the SOlution table for hospital to see the order that GLIMMIX is using.

There is no streamlining. One can write a macro to do this, but you need to know how to write simple macros and inserting them within procedures. There are examples in SAS for Mixed Models, 2nd edition. You can put everything in one big estimate statement, separating by commas, but you still have to write out all the coefficients.

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

04-28-2015 11:02 AM

Great, thank you so much for your help. I really appreciate it.

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

Posted in reply to mikemangini

04-29-2015 01:51 PM

Hopefully future versions of SAS/STAT will implement something like the DIFF=ANOM from the LSMEANS statement, but for the BLUPs like you are doing. That would be pretty useful, especially in the analysis of breeding records.

Steve Denham