How to Create New Variables to Describe Transportation Physical Activity

Study participants aged 12 years and older were asked to indicate whether they walked or biked to get to school, work, or run errands over the 30 days preceding the interview. These data are found in the PAQ dataset.   

For the PAQMSTR.sas program, we will calculate Transportation MET minutes per week (TRMMPW) using a MET score of 4.0, which indicates moderate-intensity activity descriptive of transportation physical activity. We will also create a Transportation MET minutes per week (TRMMPW) variable.

PAQ Variables and Program Notes
*  RPAD020: Walked or bicycled over past 30 days (1 = Yes, 2 = No)       
*  PAQ050Q: Number of times walked or bicycled (range of values: 1 to 124)
*  PAQ050U: Unit of measure (day/week/month)(1 = Day, 2 = Week, 3 = Month)
*  PAD080: How long per day (minutes)(range of values: 1 to 600)

The table below includes segments of code from the PAQMSTR.sas program.

Annotated Code for PAQMSTR.sas program
Program Description SAS Code
See “Important Note” below.

TRNUMTIM = PAQ050Q;

if PAQ050U = 2 and TRNUMTIM > 7 then TRNUMTIM = 7 ;

else if PAQ050U = 3 and TRNUMTIM > 30 then TRNUMTIM = 30 ;

else if PAQ050U = 1 then TRNUMTIM = 1 ;

For study participants who indicated no activity in the transportation domain, set TRMINW and TRMMPW to ‘0’. If study participant indicated activity in the transportation domain, but had missing or unknown values for frequency or duration of the activity, set TRMINW and TRMMPW to ‘.’ (missing).

if RPAD020 = 2 then TRMINW = 2 ;

if RPAD020 = 2 then TRMMPW = 2 ;

if RPAD020 = 1 and (PAQ050Q = 99999 or PAQ050Q = 77777 ) then TRMINW = . ;

if RPAC020 = 1 and (PAQ050Q = 99999 or PAQ050Q = 77777 ) then TRMMPW = . ;

if RPAD020 = 1 and (PAD080 = 99999 or PAD080 = 77777 )   then TRMINW = . ;

if RPAD020 = 1 and (PAD080 = 99999 or PAD080 = 77777 )   then TRMMPW = . ;

Calculate TRMINW and TRMMPW for SPs who indicated they performed transportation activity and reported valid frequency and duration for the activity.

else if RPAD020 = 1 and ( 1 <= PAQ050Q <= 124 ) and ( 1 <= PAD080 <= 600 )
then do ;

if PAQ050U = 1

TRMINW =(PAD080*TRNUMTIM)*