Programming the statistical procedures from SAS

Logistic Regression using unique Patient ID

Accepted Solution Solved
Reply
Contributor
Posts: 48
Accepted Solution

Logistic Regression using unique Patient ID

[ Edited ]

Hi, I am running a logistic regression model from an excel dataset, where each patient has multiple rows with information, so the Patient, Cancer, and Gender column are always the same, but the therapy column has different values. Like this example below:

 

Patient     Cancer  Gender    Therapy

1                 Y              F          234

1                 Y              F          234

1                 Y              F          555

2                 N             M         444  

2                 N             M         777

 

I'm trying to run a logistic regression where it doesn't count the multiple observations and only counts Patient 1 as 1 observation. It's been messing with my numbers and I'm not sure how to fix it.

 

This is how I usually code in proc logistic:

 

Proc logistic data=Data;
class Gender (ref="M") /param=ref;
model Disease (ref="N")= gender;
Run; 

 

Thank you!!


Accepted Solutions
Solution
‎06-07-2018 12:14 PM
Super User
Posts: 10,778

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian
Good Question.
If you want more accuracy then pick PROC GLIMMIX,
If you want handle big data then pick PROC GEE .



View solution in original post


All Replies
Contributor
Posts: 48

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian

I've been looking up certain ways of doing this, and I found SAS pdf's that mentioned using Patient ID's as a repeated measure. Does anyone know how that would work with logistic regression?

Thank you!

Regular Contributor
Posts: 161

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian

to answer your first question, it would be wasteful to discard data but if there's some reason for using the first obs for each patient you can reduce the data set using "proc sort data=data nodupkey; by patient; run;"

 

you're right, however, with your second post, ie you likely want to use the repeated values for each patient. We would need to know more about the design of the study, eg the order the treatments were received, what exactly the outcome is etc. A cross over design is not uncommon and is maybe analogous. You can likely find SAS code examples online for a binary outcome. Note that you would not use proc logistic, in that case. Maybe you use proc nlmixed or genmod: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_intromix_a0...

--------------
blog: papersandprograms.com
Contributor
Posts: 48

Re: Logistic Regression using unique Patient ID

Posted in reply to PaulBrownPhD

Thank you so much for responding to my thread. I've been playing around with Proc Glimmix, and it seems to be working fine, do you think this would be a better way of doing it over Proc Genmod?

 

PROC GLIMMIX DATA=Data;
CLASS ID Gender (ref= "M");
MODEL Disease (ref="N") = Gender /DIST=binary oddsratio;
RANDOM INTERCEPT /SUBJECT=ID TYPE=UN;
RUN;

 

 

Regular Contributor
Posts: 161

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian

but you don't have therapy in your model. Isn't that the most important thing? You seem to be interested in gender, but surely therapy is more likely to influence patient outcomes? It depends on why the study was designed, the objective and hypotheses etc. Personally, I'm not too familiar with glimmix, i used it many years ago when it was just a macro sas hadn't fully released. I would tend to use nlmixed. Glimmix v nlmixed is an interesting discussion tho : http://www2.sas.com/proceedings/forum2007/179-2007.pdf

--------------
blog: papersandprograms.com
Super User
Posts: 23,724

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian

How many therapies do you have? I feel like transposing the data and using dummy variables/one hot encoding makes sense as well here since none of the other data changes across rows?

 

It would become:

 

Patient Cancer Gender Therapy_234 Therapy_555 Therapy_444 Therapy_777

1 Y F 1 1 0 0

2 N M 0 0 1 1

 

This would also make sense if you have a baseline therapy you're comparing to. 

 

Contributor
Posts: 48

Re: Logistic Regression using unique Patient ID

Hi Reeza,

 

Thank you for responding, I'm not sure how I would do that. I am still pretty new to SAS. But I have 200 unique patients!

Super User
Posts: 23,724

Re: Logistic Regression using unique Patient ID

[ Edited ]
Posted in reply to kmardinian

The number of patients doesn't matter (edit: to the question I asked), the number of therapies do. 

 

Do you have the number of therapies?

 

You can use PROC TRANSPOSE to transpose your data and then create the 0/1's as necessary. The code is simple and we can help with that, but the methodology is more important first.

 

 

Contributor
Posts: 48

Re: Logistic Regression using unique Patient ID

I have a total of 20 different therapies between 200 patients, thank you!

Super User
Posts: 23,724

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian

Ok, I don't think either way is going to matter, you have too many variables and too little observations - the general rule is 25-30 obs per variable. And since Therapy has 20 levels that'll be too complex.  Not sure if the NLMIXED is appropriate. I'm going to move this to the stats forum so some people smarter than me can answer it Smiley Happy

Contributor
Posts: 48

Re: Logistic Regression using unique Patient ID

Thank you Reeza, I appreciate all the help!

Super User
Posts: 10,778

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian
1) PROC GEE
2) PROC GLIMMIX


Contributor
Posts: 48

Re: Logistic Regression using unique Patient ID

Thank you so much for responding. Is there a reason I would use proc
glimmix instead of proc genmod?
Solution
‎06-07-2018 12:14 PM
Super User
Posts: 10,778

Re: Logistic Regression using unique Patient ID

Posted in reply to kmardinian
Good Question.
If you want more accuracy then pick PROC GLIMMIX,
If you want handle big data then pick PROC GEE .



☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 13 replies
  • 311 views
  • 0 likes
  • 4 in conversation