Hi everyone!
I'm creating a new variable, and I'm having issues with the IF-THEN-ELSE statements. For my variable, I would like to calculate the weekly minutes only if that participant has a MET value (either Moderate or Vigorous). Therefore, people without a MET value won't get the calculation.
So, participants may or may not have a MET value (indicated by Vigorous or Moderate). If they do have a MET value, I would like to calculate their average weekly activity (min_week = ((a*b*7)/30)). So, if someone with a MET value =., I don't want to give them an average weekly activity.
Hope I made some sense
data exercise.writeinsMETS;
set exercise.writeinsMETS;
if METS="Vigorous" or METS = "Moderate";
else if writein38_min_week=((v5qa38a*v5qa38b*7)/30);
else if writein39_min_week=((v5qa39a*v5qa39b*7)/30);
else if writein40_min_week=((v5qa40a*v5qa40b*7)/30);
else max(writein38_min_week, writein39_min_week,writein40_min_week) = .;
run;
The attached data portion is something I don't want. The highlighted values in the min_week columb need to be missing