Task 1a: How to Format and Label NHANES Variables in SAS

Here are the steps to formatting and labeling NHANES variables :

 

Step 1: Define custom formats

These user-defined formats used here include the:

Use proc format with a value statement for each variable to assign the format to the selected value. Don't forget to put format names in single or double quotation marks.

Info iconIMPORTANT NOTE

When defining formats in SAS, do not forget to put format names in single or double quotation marks.

 

 

Step 2: Apply formats to variables

After you have assigned formats, you can apply them to selected variables using the format statement in the data step of your code. Please note that format names always come directly after variable names and MUST end with a period.

 

 

Step 3: Apply labels to variables

Finally, label selected variables using a label statement. User-defined labels should always be surrounded by single quotation marks.

 

 

close window icon Close Window