In this task, you will check for outliers and their potential impact using the following steps:
Before you analyze your data, it is very important that you check the distribution and normality of the data and identify outliers for continuous variables.
Statements | Explanation |
---|---|
data =demo3_nh 2 normal plot; |
Use the proc univariate procedure to get all default descriptive statistics, such as mean, minimum and maximum values, standard deviation, and skewness, etc. Use the normal plot option to obtain a plot of normality. |
where n2ah0047>=20 ; |
Use the where statement to select the participants who were age 20 years and older. |
id seqn; |
Use the id statement to list the sequence numbers associated with extreme values in the output. |
var n2lb0421; |
Use the var statement to list the variables of interest. |
Highlighted items from the univariate analysis output:
In this example, you will plot the examined sample survey weight (n2ah0282) against the distribution of the cholesterol variable to determine whether the extreme observations are influential outliers.
Statements | Explanation |
---|---|
symbol1 value =dot height = .2; |
Use the option statements, symbol and height, to format the output of the plot. |
data =demo3_nh2; plot n2ah0282*n2lb0421/ frame ; title 'NHANES II, adults age 20 years and older' ; ; |
Use the proc gplot procedure to plot the total serum cholesterol (n2lb0421) by the corresponding sample weight for each observation in the dataset. Use the where statement to select the participants who were age 20 years and older. |
Highlighted items from plotting the survey weight against the distribution of the cholesterol variable:
In this step you will:
Statements | Explanation |
---|---|
set demo3_nh2; |
temp4_nh2;
Use the data and set statements to refer to your analytic dataset. |
if seqn in (2474, 18622) then delete; |
Use the if, then statements to delete the outliers using their SEQN previously identified in the plot of survey weight versus distribution of the variable. The SEQNs associated with these outliers are listed in the proc univariate output under extreme observations. |
data =temp4_nh2 mean stderr maxdec = 1 ; |
Use the proc means procedure to determine the mean and standard error for the dataset without the outliers. |
where n2ah0047>=20 ; |
Use the where statement to select the participants who were age 20 years and older. |
var n2lb0421; |
Use the var statement to indicate the variable of interest. |
class n2ah0056; |
Use the class statement to group the variable of interest by race categories. |
weight n2ah0282; |
Use the weight statement to account for the unequal probability of sampling and non-response. In this example, the examined sample weight is used. |
data=demo3_nh2 mean stderr maxdec=1; |
Use the proc means procedure to determine the mean and standard error for the dataset with the outliers. |
where n2ah0047>=20 ; |
Use the where statement to select the participants who were age 20 years and older. |
var n2lb0421; |
Use the var statement to indicate the variable of interest. |
class n2ah0056; |
Use the class statement to group the variable of interest by race categories. |
weight n2ah0282; |
Use the weight statement to account for the unequal probability of sampling and non-response. In this example, the examined sample weight for all six years of data is used. |
Highlighted items from comparison of the results with and without outliers: