BookmarkSubscribeRSS Feed
epi101
Fluorite | Level 6

Dear users, 

 

I am trying to create a overall total physical activity variable. 

 

This is my code: 

*TOTAL LEVEL OF PHYSICAL ACTIVITY (MET_hrs/WEEK);
TOTAL_PAHRS= MET_MODRECHRS + MET_VIGRECHRS + MET_MODWORKHRS + MET_VIGWORKHRS;

 

The problem with this is that is only taking those individuals who have values in each one of these variables and creating one. Which is increasing missing values. 

 

My question is how do I create a variable that includes individuals who do all of these type of physical activity or do only one, or  a combination.  

 

My main goal is to create a final variable that assigns each individuals with a total physical activity MET score. 

 

Thank you for your help!

 

 

 

 

1 REPLY 1
PaigeMiller
Diamond | Level 26

Duplicate thread.

 

Please place all replies at: https://communities.sas.com/t5/SAS-Procedures/creating-a-variable/m-p/511077#M73040

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 601 views
  • 0 likes
  • 2 in conversation