Programming the statistical procedures from SAS

Proc Genmod - stratified analysis: by statement, where statement or ?

Reply
Occasional Contributor
Posts: 7

Proc Genmod - stratified analysis: by statement, where statement or ?

Hello - I'm trying to do a stratified analysis on my data using proc genmod, but I am having issues with the BY statement not working. I also read that the Where statement is inappropriate to use for a weighted analysis (http://support.sas.com/resources/papers/proceedings13/272-2013.pdf).

I ended up creating datasets with say only Female or Male and doing the analysis that way though I am getting an error here as well, model not converging, I think it may be parameter limit, though I had hoped using the weights would help with that.

"ERROR: The mean parameter is either invalid or at a limit of its range for some observations."

Any insight on how to get around error, or a better method of stratifying? Thanks

(code below - estimating prevalence ratios - please excuse the coding, i'm still a novice)

data fullexp.allnissumRPMal;

set fullexp.allnissumRP;

where gender = 1;

run;

proc genmod data = fullexp.allnissumRPMal desc;

class heat (ref='0') zipinc_qrtl (ref='4') agecat3 (ref='2') race1 (ref='1') uninsured (ref='0') hosp_bedsize (ref='3') urban (ref='2') hosp_region (ref='2') cm_chf (ref='0') cm_dm (ref='0') cm_renlfail (ref='0') cm_htn_c (ref='0') cm_neuro (ref='0') cm_psych (ref='0') cm_chrnlung (ref='0') / param = ref;

model died=heat zipinc_qrtl agecat3 race1 uninsured hosp_bedsize urban hosp_region cm_chf cm_dm cm_renlfail cm_neuro cm_psych cm_chrnlung cm_htn_c/link=log dist=bin type3;

weight finalwt;

title1 'Outcome Analysis';

title2 'Death - Respiratory - BY GENDER - Male';

ods output parameterestimates = mod1deadg2;

run;

data mod1deadg2;

      set mod1deadg2;

      RR = exp(estimate);

      LL = exp(lowerwaldcl);

      UL = exp(upperwaldcl);

proc print data = mod1deadg2;

      var parameter RR LL UL;

run;

Super Contributor
Posts: 287

Re: Proc Genmod - stratified analysis: by statement, where statement or ?

Hi,

I see this problem sometimes. I don't think the error message has anything to do with your stratification on gender. And also not a coding mistake.

The problem often occur in binary regression models when the link-function is different from the canonical link-function. The canonical link function in a logistic regression is the logit-function, -not the log function as you specified. There is no mechanism that guarantee that the maximum-likelihood estimate exists within the allowed range of expected values (here the interval (0-1) ), when the log-function is used instead of the logit function (the canonical link).

You can see if the problem dissappear when you use the logit function, but then you should also be aware that you estimate log(OR) and not log(RR). This is maybe not what you want, but my disappoint answer is that the log(RR) can not always be estimated with a Maximum likelihood method.

It can also be that you can estimate the log(RR) for most of you covariates, and therefore the problem may dissappear when you remove one of you covariates.

best,

jacob

Occasional Contributor
Posts: 7

Re: Proc Genmod - stratified analysis: by statement, where statement or ?

I had thought that might be the case as I ran into that issue with proc glimmix and had to use different optimization techniques to get the model to run.

Very much appreciate the insight!

-Michael

SAS Employee
Posts: 240

Re: Proc Genmod - stratified analysis: by statement, where statement or ?

Rather than use a log-linked binomial model which can have the estimating problems that Jacob mentioned, you could try using a Poisson model with offset. See discussion of Zou's modified Poisson approach (and discussion of the log-linked binomial approach) in this note:

   23003 - Estimating a relative risk (prevalence ratio)

Occasional Contributor
Posts: 7

Re: Proc Genmod - stratified analysis: by statement, where statement or ?

StatDave,

Thank you for that information. I'll have to do a bit of work to see how my variables fit in those models (particularly the GEE) as I am not used them, but I greatly appreciate the response, looks promising.

-Michael

Ask a Question
Discussion stats
  • 4 replies
  • 1839 views
  • 6 likes
  • 3 in conversation