Task 2b: How to Use SAS 9.1 Survey Code to Perform Logistic Regression

In this module, you will use NHANES data to assess the association between several risk factors and the likelihood of having hypertension for participants 20 years and older. The dependent variable Y is hypertension, and the independent variables Xj, or covariates, are age, gender, high cholesterol, body mass index, and fasting triglycerides. In this task , you will only be reviewing the Multivariate Logistic Procedure.


Step 1: Create new weight variable for Domain (Subpopulation) Analysis

You should not use a where clause or by-group processing in order to analyze a subpopulation with the SAS Survey Procedures. To get an approximate domain (subpopulation) analysis when using proc surveylogistic, you assign a near zero weight to observations that do not belong to your current domain. The reason that you cannot make the weight zero is that the procedure will exclude any observation with zero weight. In this example, you have a domain (subpopulation) where age is greater than or equal to 20 years, and if you specify in a data step: 

     if ridageyr GE 20 then newweight=wtsaf4yr; 

     else newweight=1e-6;

you could then perform the logistic regression using the newweight variable as:

     weight newweight;



SAS Technical Support.



Step 2: Review SAS Multivariate Logistic Procedure

This step introduces you to the SAS multivariate survey Logistic Regression procedure, proc surveylogistic. There is a summary table of the SAS program below.


information icon These programs use variable formats listed in the Tutorial Formats page. You may need to format the variables in your dataset the same way to reproduce results presented in the tutorial.

SAS Multivariate Logistic Procedure

Statements Explanation


Use the proc surveylogistic procedure to perform multiple logistic regression to assess the association between hypertension and multiple risk factors, including: age, gender, high cholesterol, body mass index, and fasting triglycerides.

STRATUM sdmvstra; 

Use the stratum statement to specify strata to account for design effects of stratification.

CLUSTER sdmvpsu;


Use the cluster statement to specify primary sampling unit (PSU) to account for design effects of clustering.

WEIGHT newweight;

Use the weight statement to account for the unequal probability of sampling and non-response. In this example, you use the new weight variable created in the data step. See Step 1.

CLASS age (PARAM=REF REF='40-59 yrs')

riagendr (PARAM=REF REF='Female')

hichol (PARAM=REF REF='high cholesterol')

bmigrp (PARAM=REF REF='25<=BMI<30');

Use the class statement to specify all categorical variables in the model.

Use the param and ref options to choose your reference group for the categorical variables.

MODEL hyper (desc)=age riagendr hichol bmigrp logtrig;

Use the model statement to specify the dependent variable and all independent variable(s) in your Logistic Regression model.

format age agefmt. riagendr sexfmt. hichol chfmt. bmigrp bmifmt.;


Use the format statement to read the SAS formats  for all formatted variables.


warning icon The SAS Survey Procedure, proc surveylogistic, produces the Wald statistic and its p value. It does not produce the Satterthwaite χ2 or the Satterthwaite F and the corresponding p values recommended for NHANES analyses. For this reason, it is recommended that you use proc rlogist in SUDAAN for logistic regression.



Step 3: Review SAS Multivariate Logistic Regression Output

In this step, the SAS output is reviewed. You can compare your results with the sample output, which you can download from the Sample Code and Datasets page. Or, you can view an animated version of the results with narration by clicking the link below. In the narration, the highlighted elements show that:


close window icon Close Window