PROC LOGISTIC

Now that we have a reasonable feel for at least simple logistic regression, we can examine PROC LOGISTIC a bit more.


The simplest call to PROC LOGISTIC has to be used with caution since SAS does not require that the outcome be coded as 0,1.


One can specify which value of a dichotomous outcome should be treated as the event.


The descending option reverses the default order for the event variable.


It is easy to retrieve the estimated probabilities, either for a new data set or the data set used to fit the model.



Homework
Create a data set that contains a single variable, sbp. There should be a single observation for all values of sbp from 120 to 170.
Estimate a logistic model relating sbp to chd in lipid2018_b data set, scoring the data on the dataset you created and creating a new data set.
Graph the estimated probabilities of sbp on the scored data set.


It is sometimes useful to retrieve the estimated parameters into a SAS data set.



Homework
Estimate a logistic model relating age to chd in lipid2018_b data set. Use an option in the PROC LOGISTIC statement to create a data set called betas that contains the estimated parameters.
Print the data set betas and examine the data.



Homework
Estimate a logistic model relating age to chd in lipid2018_b data set.
Use an ODS statement to create a data set, betas1, containing the parameter estimates.
Print the data set betas1 and examine the data.


A handy capability of SAS procs is BY GROUP processing.



Homework
Use single proc logistic step with the data set lipid2018_b to estimate a logistic model relating age to chd, separately for males and females.
Restrict the displayed results to just the parameter estimates.
Use an ODS statement to create a data set, betas that contains the estimates of the parameters.
Print the data set betas and examine the data.


Saving the estimated covariance matrix and/or displaying it in the results is easily accomplished.



Homework
Estimate a logistic model relating age to chd in the lipid2018_b data set.
Use an option to create a dataset, betas, the contains both the estimated parameters and their covariance matrix.
Print the data set betas and examine its content.


You can examine the ODS file with the ODS trace statement. You can specify plots to be produced in the results.



Homework
Estimate a logistic model relating age to chd in the lipid2018_b data set. Use ODS statements to examine the name of the results files that are created.
Write a new program to estimate a logistic model relating age to chd in the lipid2018_b data set. Restrict the results displayed to the global tests of the model.


The freq statement allows you to model summarized data.


Data summarized in "binomial" format may be analyzed.



The slides used in the videos are found here