Simple Logistic Regression using SAS

 

We still want to use the mpg data file and there is no binary variable in that data set. So we need to combine the variable about the number of cylinders (cyl) into two groups: <6 or >= 6. The new variable cyl_two will be coded as 1 is cyl >= 6 or 0 if cyl < 6. Cyl_two will be used as outcome variable and use highway mpg (hwy) as predictor variable. The expb option in the model statement will give you the odds ratios.

data mpg;
  set mpg;
  if cyl >= 6 then cyl_two = 1;
  else cyl_two = 0;
run;
proc logistic data = mpg desc;
  model cyl_two = hwy / expb;
run;

SAS single logistic regression

The results indicate that highway mpg (hwy) is a statistically significant predictor of the number of cylinders (i.e., being >= 6), Wald chi-square =46.9416, p = <.0001.

 

 

See Also:

Do the same test in R

Leave a Reply

Your email address will not be published. Required fields are marked *