Macro Name 
Logistic Regression 
Description 
This is a macro for performing logistic regression with a binary outcome, checking model assumptions, and producing output that is arranged in a way suitable for use in publications. Some features that add convenience include automatically creating quartile categories for specified predictors, rescaling numeric predictors to make odds ratios more interpretable, and showing counts for categorical predictors. Relevant links: Logistic.sas: The main macro. LogisticPrint.sas: For printing data sets created by multiple calls of the Logistic macro. logisticHtml.sas: Creates hyperlinked and highlighted output file. SampleLogisticRun.sas: Example sas program using the Logistic and LogisticHtml macros. LogisticHtmlExample.html: The file produced by the above example program. Check list: Suggestions of what to look for in the output and how to deal with some issues that you may find. 
Macro Parameters 
Parameters for Logistic Macro: DSName = name of SAS data set Outcome = name of outcome variable. This variable is assumed to be coded 0, 1 and the model predicts the probability of a 1 outcome. Predictors = list of predictor variables. This list should include class variables and variables to be 'quartiled.' Interaction variables may be included in which case the predictor list should be quoted, e.g. Predictors = %quote(Age Gender Age*Gender). Note: all variables appearing in interaction terms should also appear as main effects. Classvar = classification variables with reference level. Use %quote function. For example, Classvar=%quote(Gender(ref='Male')Race(ref='Asian')) Gender and Race could be numeric variables with formatted values of Male or Asian or they could be alphanumeric variables with string values of 'Male' and 'Asian'. Do not include variables for which quartiles are to be generated. Quartiles = list of numeric variables which should be entered into the model as class variables with four quartile levels. Variables in this list will not be included in the model as linear predictors. Quad = Y/N for creating and testing quadratic terms (default = Y) Out = name of output SAS data set containing logistic estimates, pvalues, etc. Print = Y/N (default = N) Include = F,P,FP,or N F = frequencies of outcome variable are displayed for each class variable value, e.g., Sex Female 31/100 P = percentages are displayed with class variable values, e.g., Sex Female 31.0% FP = frequencies and percentages are displayed with class variable values, e.g., Sex Female 31/100 (31.0%). N = no frequencies or percentages are displayed with class variable values (default = FP) Obs = Y/N If Y, then the number of observations in each outcome group and the total are displayed. (default = Y) LL = Y/N If Y, then 2log(likelihood) is displayed. (default = N) HL = Y/N If Y, then the HosmerLemeshow pvalue is displayed along with the number of groups of estimates (default = N). 
Programmer  UCSF  Peter Bacchetti 
Revision 

Disclaimer 

Example(s) 

Special Features 
Special Features of Logistic macro: The macro will automatically test a quadratic term for numeric (nonclass) predictors with more than two values. The macro will automatically output odds ratios that have been rescaled until the units > 1/10 of the IQR. 
Called Macros 
Macros called by Logistic Macro: %words, %checkvar, %univariate, and %quartiles 
Notes 
Pending Work 1. Investigate and fix warning messages in SampleLogisticRun. 2. Add standard headings to all macros. 3. Investigate the best way to have hyperlinks in LogisticHtml output open in a new window. 4. A macro similar to LogisticHtml that produces an output file suitable for pasting selected results tables into manuscripts. 
See Also  Research Topic: Logistic Regression 
I  Attachment  Action  Size  Date  Who  Comment 

sas  SampleLogisticRun.sas  manage  3.1 K  18 Aug 2009  17:47  ChengshiJin  Example sas program using the Logistic and LogisticHtml macros. 
sas  SampleLogisticRunCall.sas  manage  0.2 K  18 Aug 2009  17:45  ChengshiJin  Call for internal testing of completeness of postings 
sas  logisticHtml.sas  manage  8.4 K  18 Aug 2009  17:46  ChengshiJin  Creates hyperlinked and highlighted output file. 
sas  logisticHtml1.sas  manage  8.4 K  18 Aug 2009  12:45  ChengshiJin  For printing data sets created by multiple calls of the Logistic macro. 