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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register 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
  • 865 views
  • 0 likes
  • 2 in conversation