Task 1: Key Concepts about Formats and Labels in NHANES

Formats and labels are user-defined tools that provide a convenient way to describe variables and their numeric values in SAS or SUDAAN output.  The use of formatting and labeling is optional, but investigators often rely on these tools because they help in keeping track of frequently used variables and they add clarity to programming output.

Formatting is used to assign descriptive text names to numeric and character values of a variable. For example, you can create a format that you name “YESNO.”  In this case, “Yes” represents values of 1 and “No” represents values of 2.  You can then apply this format to a variable in the dataset that has the same response categories (i.e., 1 and 2).  As a result, in your output, all of the 1 values of that variable are represented by “Yes” and all of the 2 values of that variable are represented by “No.”

Labeling, on the other hand, allows you to assign descriptive titles to variable names.  As explained in the Locating Variables module, variables have names that are an abbreviated series of letters or letters and numbers (e.g., RIDAGEYR, DI1ICALC).  Labeling is a way to flesh out this shorthand with some explanatory detail.  For example, the variable "FOODGRP" can be given the label "Broad food group – based on first digit of USDA food code." 

The distinction between formatting and labeling variables is that formats are applied to the values of a variable, whereas labels are applied to a variable name.  Formats must be explicitly defined in the code, and this step is usually done at the beginning of a program.  Labels can be added at any point in the code.


close window icon Close Window to return to module page.