BookmarkSubscribeRSS Feed
danirecchia
Calcite | Level 5

Hello dear users,

I am wondering if I cant just exclude one group from my class variable by the logistic regression I mean, if I have the variable age:

proc format;

value agegroup  18-25 = 'age1'

                          25-35 = 'age2'

                         35-high= 'age3';

run;

data test;

set scoring;

retain Age_cat;

Age_cat = put(age,agegroup.);

run;

proc logistic data = test;

class Age_cat;

model y=Age_cat + x1;

run;

If I see that for example the age2 is no significant, can I just delete this group from the logistic procedure?

Thank you

2 REPLIES 2
PGStats
Opal | Level 21

Hi, be careful when performing logistic ANCOVAs.

/* Add a grouping variable */

data test;

set scoring;

Age_cat = put(age,agegroup.);

run;

/* You should first check if the effect of x1 is the same in each age group */

proc logistic data = test;

class Age_cat;

model y=Age_cat x1 Age_cat*x1;

run;

/*If the interaction term (Age_cat*x1) isn't significant then you may do the ANCOVA. Otherwise, ANCOVA results are meaningless (cannot be interpreted). */

proc logistic data = test;

class Age_cat;

model y=Age_cat x1;

run;

the only reason for removing an age group would be if x1 had a different effect for that group only and you wanted to perform an ANCOVA on the other groups.

PG

PG
StatDave
SAS Super FREQ

Ignoring other issues and given your coding, simply use a WHERE statement:

proc logistic data = test;

where Age_cat ne 'age2';

class Age_cat;

model y=Age_cat + x1;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Discussion stats
  • 2 replies
  • 1810 views
  • 0 likes
  • 3 in conversation