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

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
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
  • 1042 views
  • 0 likes
  • 2 in conversation