Programming the statistical procedures from SAS

Exclusion from a group from a class variable

Reply
Occasional Contributor
Posts: 16

Exclusion from a group from a class variable

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

Respected Advisor
Posts: 4,745

Re: Exclusion from a group from a class variable

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
SAS Employee
Posts: 241

Re: Exclusion from a group from a class variable

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;

Ask a Question
Discussion stats
  • 2 replies
  • 181 views
  • 0 likes
  • 3 in conversation