<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Code to score the global physical activity questionnaire based on previous board post in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-to-score-the-global-physical-activity-questionnaire-based/m-p/906371#M357891</link>
    <description>&lt;P&gt;Thank you for showing your log, which may be answering your question.&amp;nbsp; In particular, it includes the note&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1497 at 2010:7     4256 at 2010:18    4256 at 2010:25    3266 at 2010:36    3266 at 2010:43    4253 at 2010:54
      4253 at 2010:61    &lt;EM&gt;&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;4279 at 2010:72&lt;/STRONG&gt;&lt;/U&gt;    &lt;U&gt;&lt;STRONG&gt;4279 at 2010:79&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/EM&gt;    3383 at 2010:90    3383 at 2010:97    1497 at 2010:101&lt;/PRE&gt;
&lt;P&gt;which says that at least 4,279 of your 5,569 observations have a missing value in columns 72 and 79.&amp;nbsp; Using the statement copied below, I suspect that would be variables PAQ655 and/or PAD660.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2010  totPA=sum((PAQ610*PAD615*8),(PAQ625*PAD630*4),(PAQ640*PAD645*4),(PAQ655*PAD660*8),(PAQ670*PAD675*4))/60;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which means in turn that totPA will get assigned a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The raises the question of whether you should treat missing values for any of the PAQ variables in line 2010 as zeroes.&amp;nbsp; &amp;nbsp;After all, totPA can't be zero unless every one of the PAQ variables in the calculation are at zero.&amp;nbsp; Do those variables ever have a zero value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, perhaps you want to treat missing values as zero (look at the NHANES docs to see whether this is justified).&amp;nbsp; If so, you could do something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;totPA=sum(  (sum(0,PAQ610)*sum(0,PAD615)*8)
         ,  (sum(0,PAQ625)*sum(0,PAD630)*4)
         ,  (sum(0,PAQ640)*sum(0,PAD645)*4)
         ,  (sum(0,PAQ655)*sum(0,PAD660)*8)
         ,  (sum(0,PAQ670)*sum(0,PAD675)*4)
         )
        /60 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I repeat, make sure, for your purposes, that it is valid to treating missing values as zeroes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 02:39:42 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2023-12-06T02:39:42Z</dc:date>
    <item>
      <title>Code to score the global physical activity questionnaire based on previous board post</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-score-the-global-physical-activity-questionnaire-based/m-p/905894#M357760</link>
      <description>&lt;P&gt;I am trying to write code to score the Global Physical Activity Questionnaire from the NHANES 2017-2018 cycle. My end goal is to determine if vitamin D level is a risk factor for depression and if physical activity has a modifying effect on depression with vitamin D is low. I am using the PAQ_J dataset to determine the score. I have been referring to this community post to inform my code:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-code-Physical-Activity-in-NHANES/td-p/560375" target="_blank" rel="noopener"&gt;How to code Physical Activity in NHANES - SAS Support Communities&lt;/A&gt;. When I run my own code, I am not getting any people with 0=no physical activity and I know that cannot be correct. What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data project2;
set project2;
totPA=sum((PAQ610*PAD615*8),(PAQ625*PAD630*4),(PAQ640*PAD645*4),(PAQ655*PAD660*8),(PAQ670*PAD675*4))/60;
label totPA='Physical activity total (MET-h/wk)';
if totPA=0 then PAintensity=0;
else if 1&amp;lt;=totPA&amp;lt;=48 then PAintensity=1;
else if totPA&amp;gt;48 then PAintensity=2;
else PAintensity=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I will attach my dataset to this post as well.&amp;nbsp; I am also not sure if I am doing enough to get true values of PA, instead of missing values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my log:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;2008  Data project2;
2009  set project2;
2010  totPA=sum((PAQ610*PAD615*8),(PAQ625*PAD630*4),(PAQ640*PAD645*4),(PAQ655*PAD660*8),(PAQ670*PAD675*4))/60;
2011  label totPA='Physical activity total (MET-h/wk)';
2012  if totPA=0 then PAintensity=0;
2013  else if 1&amp;lt;=totPA&amp;lt;=48 then PAintensity=1;
2014  else if totPA&amp;gt;48 then PAintensity=2;
2015  else PAintensity=.;
2016  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1497 at 2010:7     4256 at 2010:18    4256 at 2010:25    3266 at 2010:36    3266 at 2010:43    4253 at 2010:54
      4253 at 2010:61    4279 at 2010:72    4279 at 2010:79    3383 at 2010:90    3383 at 2010:97    1497 at 2010:101
NOTE: There were 5569 observations read from the data set WORK.PROJECT2.
NOTE: The data set WORK.PROJECT2 has 5569 observations and 28 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please help!&lt;/P&gt;</description>
      <pubDate>Sun, 03 Dec 2023 16:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-score-the-global-physical-activity-questionnaire-based/m-p/905894#M357760</guid>
      <dc:creator>hanner1985</dc:creator>
      <dc:date>2023-12-03T16:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Code to score the global physical activity questionnaire based on previous board post</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-score-the-global-physical-activity-questionnaire-based/m-p/906371#M357891</link>
      <description>&lt;P&gt;Thank you for showing your log, which may be answering your question.&amp;nbsp; In particular, it includes the note&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1497 at 2010:7     4256 at 2010:18    4256 at 2010:25    3266 at 2010:36    3266 at 2010:43    4253 at 2010:54
      4253 at 2010:61    &lt;EM&gt;&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;4279 at 2010:72&lt;/STRONG&gt;&lt;/U&gt;    &lt;U&gt;&lt;STRONG&gt;4279 at 2010:79&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/EM&gt;    3383 at 2010:90    3383 at 2010:97    1497 at 2010:101&lt;/PRE&gt;
&lt;P&gt;which says that at least 4,279 of your 5,569 observations have a missing value in columns 72 and 79.&amp;nbsp; Using the statement copied below, I suspect that would be variables PAQ655 and/or PAD660.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2010  totPA=sum((PAQ610*PAD615*8),(PAQ625*PAD630*4),(PAQ640*PAD645*4),(PAQ655*PAD660*8),(PAQ670*PAD675*4))/60;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which means in turn that totPA will get assigned a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The raises the question of whether you should treat missing values for any of the PAQ variables in line 2010 as zeroes.&amp;nbsp; &amp;nbsp;After all, totPA can't be zero unless every one of the PAQ variables in the calculation are at zero.&amp;nbsp; Do those variables ever have a zero value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, perhaps you want to treat missing values as zero (look at the NHANES docs to see whether this is justified).&amp;nbsp; If so, you could do something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;totPA=sum(  (sum(0,PAQ610)*sum(0,PAD615)*8)
         ,  (sum(0,PAQ625)*sum(0,PAD630)*4)
         ,  (sum(0,PAQ640)*sum(0,PAD645)*4)
         ,  (sum(0,PAQ655)*sum(0,PAD660)*8)
         ,  (sum(0,PAQ670)*sum(0,PAD675)*4)
         )
        /60 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I repeat, make sure, for your purposes, that it is valid to treating missing values as zeroes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 02:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-score-the-global-physical-activity-questionnaire-based/m-p/906371#M357891</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-12-06T02:39:42Z</dc:date>
    </item>
  </channel>
</rss>

