How to Create New Variables to Describe Household/Yard Physical Activity

Study participants aged 16 years and older were asked to indicate whether they performed household or yard work in bouts of 10 minutes or more that required moderate physical effort over the 30 days preceding the interview. These data are found in the PAQ dataset. 

For the PAQMSTR.sas program, we will calculate Household/Yard MET minutes per week (HHMMPW) using a MET score of 4.5, which indicates moderate intensity activity. We will also create a Household/Yard min/wk (HHMINW) variable.

PAQ Variables and Program Notes
* RPAQ100: Tasks around home/yard past 30 days (1 = Yes, 2 = No).        
* PAD120: Number of times past 30 days (range of values: 1 to 300).
* PAD160: How long each time (minutes) (range of values: 1 to 600)                        
* Use "4.3" as the average number of weeks in a month or 30 days.

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

Annotated Code for PAQMSTR.sas program
Program Description SAS Code
For study participants who indicated no activity in the household/yard domain, set HHMINW and HHMMPW to ‘0’. If study participant indicated activity in the household/yard domain, but had missing or unknown values for frequency or duration of the activity, set HHMINW and HHMMPW to ‘.’ (missing).

if RPAQ100 = 2 then HHMINW = 0 ;

if RPAQ100 = 2 then HHMMPW = 0 ;

if RPAQ100 = 1 and (PAD120 = 99999 or PAD120 = 77777 )
then HHMINW = . ;

if RPAQ100 = 1 and (PAD120 = 99999 or PAD120 = 77777 )
then HHMMPW = . ;

if RPAQ100 = 1 and (PAD160 = 99999 or PAD160 = 77777 )
then HHMINW = . ;

if RPAQ100 = 1 and (PAD160 = 99999 or PAD160 = 77777 )
then HHMMPW = . ;

Calculate HHMINW and HHMMPW for study participants who indicated they performed household/yard activity and reported valid frequency and duration for the activity.

else if RPAQ100 = 1 and (1 <= PAD120 <= 300 ) and ( 1 <= PAD160 <= 600 )
then do ;

      HHMINW = (PAD120*PAD160)/4.3 ;
      HHMMPW = (HHMINW)*4.5 ;
end ;
label HHMINW = 'Household and Yard Work min/wk'
      HHMMPW = 'Household and Yard Work MET min/wk' ;