How to Create Custom Formats to Describe Physical Activity Monitor Data

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.”

To create custom formats for your dataset, you will need to use the PROC FORMAT procedure. Using the VALUE statement, you first assign a name to a format. Then, you use descriptive text to define the values of the format. Note that all assigned text names for the values must be surrounded by single quotation marks in order to be applied properly.

The sample code below shows how to name and define custom formats that will be used to describe summary metrics for each study participant included in the analysis. (Note that you can assign any name you choose, so long as it meets the SAS specifications for a valid format name. See a SAS manual for more information.)

Sample Code

proc format ;

*Yes or No;
value yesno
  1 = 'Yes'
  0 = 'No' ;

*Day of the week;
value wkday
  1 = 'Sunday'
  2 = 'Monday'
  3 = 'Tuesday'
  4 = 'Wednesday'
  5 = 'Thursday'
  6 = 'Friday'
  7 = 'Saturday' ;

value gender
  1 = 'Male'
  2 = 'Female' ;

*Age Group;
value agegrp
  0 = 'All'
  1 = '6-11'
  2 = '12-15'
  3 = '16-19'
  4 = '20-29'
  5 = '30-39'
  6 = '40-49'
  7 = '50-59'
  8 = '60-69'
  9 = '70+' ;
run ;