BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gejoachim99
Fluorite | Level 6

I am doing logistic regression using all categorical variables. When I create a 2x2 table of the outcome (casehyst_path) and the exposure (jointyears_cat), each level of jointyears_cat (0, 1, 2 and 3) all show up. But when I run the logistic regression, it ignores 0, and uses 1 as the reference, even though I specified ref=first. Here is my code, and I've attached screenshots of my results. Any help is appreciated! Thanks. 

 

data work.adeno1;
set work.adenovar;
if jointyears = 0 or hash = 2 then jointyears_cat = "0";
if 0 LT jointyears LE 2 then jointyears_cat = "1";
if 2 LT jointyears LE 5 then jointyears_cat = "2";
else if jointyears GT 5 then jointyears_cat = "3";

 

data work.adenovar;
set work.adeno1;
if 20 LE refage LE 34 then refagecat = "0";
if 35 LE refage LE 39 then refagecat = "1";
if 40 LE refage LE 44 then refagecat = "2";
if 45 LE refage LE 49 then refagecat = "3";
if 50 LE refage LE 54 then refagecat = "4";
else if 55 LE refage LE 59 then refagecat = "5";

 

if 36 LE hashlage1 LE 60 then before35 = "0";
else if 3 LE hashlage1 LE 35 then before35 = "1";
if 36 LE hashlage2 LE 60 then before35 = "0";
else if 3 LE hashlage2 LE 35 then before35 = "1";
if 36 LE hashlage3 LE 60 then before35 = "0";
else if 3 LE hashlage3 LE 35 then before35 = "1";
if 36 LE hashlage4 LE 60 then before35 = "0";
else if 3 LE hashlage4 LE 35 then before35 = "1";

 

proc freq data = work.adenovar;
where before35 = "1";
tables jointyears_cat*casehyst_path / norow nopercent;
run;

 

title "hysterectomy controls age";
proc logistic data = adenovar descending;
where before35 = "1";
class jointyears_cat refagecat / param = ref ref = first;
model casehyst_path = jointyears_cat refagecat;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Run a Proc freq on your categorical variable of interest with the same "where before35="1" ".

If you don't have any 0 where before35='1' then that is the issue: no qualifying data.

View solution in original post

2 REPLIES 2
ballardw
Super User

Run a Proc freq on your categorical variable of interest with the same "where before35="1" ".

If you don't have any 0 where before35='1' then that is the issue: no qualifying data.

gejoachim99
Fluorite | Level 6
This seems to be the case. I see my mistake now! Thank you very much.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 6201 views
  • 0 likes
  • 2 in conversation