Turn on suggestions

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

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How to get estimates for categorical variables in a Modified Poisson r...

Options

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

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 02-06-2020 09:10 AM
(5145 views)

Hi all,

I'm computing a modified poisson regression (poisson regression using a robust variance) to get RRs. This is my first time doing it and it ran okay, but I have a combination of binary and categorical variables. My output current gives me beta estimates for the binary variables accurately, however it gives me only one Beta estimate for the categorical variable and it seems as though it is treating them as binary variables.

This is my code:

```
proc genmod data = test;
class enrolid sex (ref='2') agecat(ref='1') race (ref='1') smoke (ref='0');
model diag= sex agecat race smoke / dist = poisson link = log;
repeated subject = enrolid/ type = unstr;
estimate 'Beta race' race 1 -1/exp;
estimate 'Beta smoke' smoke1 -1/exp;
estimate 'Beta sex' sex 1 -1/exp;
estimate 'Beta agecat' agecat 1 -1/exp;
run;
```

This is what my results look like :

Race has 4 levels and Agecat has 5 levels - how do I get the mean beta estimates for all the different levels?

Sex and Smoke are binary and the results match my logistic regression so I know it's fine, but race and agecat is significantly different.

Mean estimate | Confidence limits| L'beta est |SE|

Beta Race | 0.4497 | 0.2503 | 0.6584 | 1.4928 | 0.0234 | 0.05 | 1.4470 | 1.5387 | 4073.4 | <.0001 |

Exp(Beta Race) | 4.4497 | 0.1041 | 0.05 | 4.2503 | 4.6584 | ||||

Beta Sex | 1.996 | 1.9129 | 2.0843 | 0.6915 | 0.0219 | 0.05 | 0.6486 | 0.7344 | 998.08 | <.0001 |

Exp(Beta sex) | 1.9967 | 0.0437 | 0.05 | 1.9129 | 2.0843 | ||||

Beta agecat 1.101 | 1.0448 | 1.1619 | 0.0970 | 0.0271 | 0.05 | 0.0438 | 0.1501 | 12.80 | 0.0003 |

Exp(Beta agecat) | 1.1018 | 0.0299 | 0.05 | 1.0448 | 1.1619 | ||||

Beta smoke 0.626 | 0.5831 | 0.6732 | -0.4675 | 0.0366 | 0.05 | -0.5393 | -0.3958 | 162.91 | <.0001 |

Exp(Beta smoke) | 0.6265 | 0.0230 | 0.05 | 0.5831 | 0.6732 |

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi @JME1 would you please share the code how you used LSmeans for the categorical variables.

I was wondering if LSmeans statement can be used when I have individual level data, not the aggregate count data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Would please share your SAS code after including LSMEANS statement? Your support is appreciated!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Tol,

I used this note 23003 - Estimating a relative risk (also called risk ratio, prevalence ratio) (sas.com) as mentioned by StatDave, to guide me. In the note, I used the 'Nonmodeling estimate using a logistic model' that calls the NLMeans (62362 - Estimate and test differences, ratios, or contrasts of means in generalized linear models (s...) macro and NLEst (58775 - Estimating nonlinear combinations of model parameters (sas.com) ) macro. However, you have to ensure that the macros are the latest for it to work. Because I use SAS on a server, I had to copy and paste the code from the macros into the program editor of my SAS interface and submit from there before I could proceed further. Once I could do that, the code as provided in the note I mentioned above worked perfectly.

Thank you to @FreelanceReinh for helping me figure it out! Re: %LSMeans Warning: Apparent Invocation NLMeans not resolved - SAS Support Communities

Good luck!

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.