<?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: Add constant value to all numeric variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362899#M85789</link>
    <description>&lt;P&gt;"What's wrong with Zeros in the first place?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well it's not a problem in SAS but in many programming languages, numeric values are by default, Zero.&amp;nbsp; So you can't tell the difference between missing and zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Got 10 questions and 9 need shifting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;q1=q1+1;&lt;/P&gt;
&lt;P&gt;q2=q2+1;&lt;/P&gt;
&lt;P&gt;q3=q3+1;&lt;/P&gt;
&lt;P&gt;q4=q4+1;&lt;/P&gt;
&lt;P&gt;*(skip the one you don't want to shift);&lt;/P&gt;
&lt;P&gt;q6=q6+1;&lt;/P&gt;
&lt;P&gt;q7=q7+1;&lt;/P&gt;
&lt;P&gt;q8=q8+1;&lt;/P&gt;
&lt;P&gt;q9=q9+1;&lt;/P&gt;
&lt;P&gt;q10=q10+1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;keeping it simple is the best way to go.&amp;nbsp; Try searching for a bug involving a particular variable that doesn't appear in your code because you used some programming short cut unique to some language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 May 2017 22:09:36 GMT</pubDate>
    <dc:creator>rickpaulos</dc:creator>
    <dc:date>2017-05-30T22:09:36Z</dc:date>
    <item>
      <title>Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362808#M85753</link>
      <description>&lt;P&gt;My survey data variables take 0, 1, 2,3 ... values and I have to change them to 1, 2, 3, 4 values (see attached first 10 obs data). It will help eliminate zero values to facilitate further analyses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Error log from below code is:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;&lt;EM&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a datetime constant, a missing value, iterator, (.&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&lt;EM&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
        array inc {*} _numeric_;
            do i = 1 to dim(inc);
                if inc{i} in (_all_) then inc{i} = _all_+1;
            end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I apprceiate any hints.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 17:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362808#M85753</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-30T17:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362816#M85757</link>
      <description>&lt;P&gt;What are you trying to do with this line? What do you expect _all_ to refer to? It is all listed variables so that's a really weird line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if inc{i} in (_all_) then inc{i} = _all_+1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Wouldn't it just be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;inc(i) = inc(i)+1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 May 2017 18:08:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362816#M85757</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-30T18:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362825#M85760</link>
      <description>&lt;P&gt;My survey data variables take 0, 1, 2,3 ... values and I have to change them to 1, 2, 3, 4 values (see attached first 10 obs data). It will help eliminate zero values to facilitate further analyses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is hard to imagine that adding a constant will facilitate further analysis, what problems could zeros cause? You haven't changed the distribution of the data other than by shifting it one unit to the right.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 18:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362825#M85760</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-30T18:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362837#M85766</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I'm dealing with survey data coded inconsistently. Shifting values by one unit to the right helped 7 out of 8 items included zero in the response choices. Now all zeros in the data is 1 so that those are not chopped off when following program is run. However, now my problem is that, one of items doesn't take 0 but starts from 1. After shifting, its starting value becomes 2.&amp;nbsp; I was wondering if it makes sense to shift 7 items to the right except that one item with no zero value anyway? Do you have any suggestions? thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ARRAY PFI(10) PF01-PF10;

DO I = 1 TO 10;
   IF PFI(I) &amp;lt; 1 OR PFI(I) &amp;gt; 3 THEN PFI(I) = .;
END;

PFNUM = N(OF PF01-PF10);

PFMEAN = MEAN(OF PF01-PF10);

DO I = 1 TO 10;
  IF PFI(I)= . THEN PFI(I) = PFMEAN;
END;&lt;BR /&gt;&lt;BR /&gt;IF PFNUM GE 5 THEN RAWPF = SUM(OF PF01-PF10);&lt;BR /&gt;PF = ((RAWPF - 10)/(30-10)) * 100;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 19:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362837#M85766</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-30T19:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362838#M85767</link>
      <description>&lt;P&gt;Honestly, I still don't see how zero is a problem or why you are doing this. It could be (but you haven't stated this in any way) that zero indicates a response of "not applicable" or "no answer", in which case you would want to eliminate the zeros and turn them into missings. In that case, and maybe in other cases I haven't thought about,&amp;nbsp;adding one to the data still isn't the solution, this step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DO I = 1 TO 10;
   IF PFI(I) &amp;lt; 1 OR PFI(I) &amp;gt; 3 THEN PFI(I) = .;
END;
&lt;/PRE&gt;
&lt;P&gt;is still unnecessary (although it works). Instead you could do things in a much more simple way. Don't add the ones to all of the variables; and then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if pfi(I)=0 then pfi(I)=.;&lt;/PRE&gt;
&lt;P&gt;I don't have a problem with shifting 7 variables to the right and not shifting the other one; as stated I do have a problem with the entire concept of shifting any variables to the right, I just don't see the need for it. Your computation of PF at the end needs to be adjusted, but that's all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&lt;/P&gt;
&lt;PRE&gt;PFMEAN = MEAN(OF PF01-PF10);

DO I = 1 TO 10;
  IF PFI(I)= . THEN PFI(I) = PFMEAN;
END;
&lt;/PRE&gt;
&lt;P&gt;typically assigning the mean to the missing values is a form of "imputation", but usually you assign the mean of the &lt;EM&gt;column&lt;/EM&gt;, and not the mean of the &lt;EM&gt;row&lt;/EM&gt; to replace the missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 19:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362838#M85767</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-30T19:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362848#M85769</link>
      <description>&lt;P&gt;Depends on why you have 0 in the first place and what you're trying to do overall. Why is that one question missing zero? Context is more important here, this isn't a technical problem, it's a logic issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I work with survey data regularly and don't see how this would help anything further on, except possibly align your values to match historical coding so you can use historical code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question you haven't answered - what's wrong with zeroes in the first place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 19:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362848#M85769</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-30T19:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362853#M85770</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Very interesting.&lt;/P&gt;&lt;P&gt;Zeros indicate "no, my physical activity is not limited" so is not missing. Assigning the column mean (mean(PF:)) would reflect in all study subjects' average versus imputing one's own responses' MEAN(OF PF01-PF10)?&amp;nbsp; Otherwise,&amp;nbsp;average of same item(question) mean (PF01) instead taking average of different questions mean(PF01-PF10) makes sense to me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 19:57:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362853#M85770</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-30T19:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362854#M85771</link>
      <description>&lt;P&gt;Yes, that's what the column mean would do, it's a standard type of way to replace a missing ... I have never seen replacing the missing with the row mean.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 19:59:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362854#M85771</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-30T19:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362860#M85772</link>
      <description>Hi Reeza, missing imputation and scoring program was provided to me by the author of the methodology. And i was trying to fit my data to the program provided. Now I'm willing to modify the program to the data, not other way around.</description>
      <pubDate>Tue, 30 May 2017 20:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362860#M85772</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-30T20:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362881#M85780</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is what I would do. Any objections? Here I am scoring data to 0-100 scale. So then the next step is to weight them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WANT; set HAVE;
ARRAY PFI(10) PF01-PF10;
DO I = 1 TO 10;
PFMEAN = MEAN(OF PFI(I));
IF PFI(I)= . THEN PFI(I) = PFMEAN;
END;
PFNUM = N(OF PF01-PF10);
IF PFNUM GE 5 THEN RAWPF = SUM(OF PF01-PF10);
PF = ((RAWPF - 10)/(30-10)) * 100;
LABEL  PF = 'PF SCORING (0-100)'
       RAWPF = 'PF ITEM SUMMARY';
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 21:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362881#M85780</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-30T21:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362899#M85789</link>
      <description>&lt;P&gt;"What's wrong with Zeros in the first place?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well it's not a problem in SAS but in many programming languages, numeric values are by default, Zero.&amp;nbsp; So you can't tell the difference between missing and zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Got 10 questions and 9 need shifting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;q1=q1+1;&lt;/P&gt;
&lt;P&gt;q2=q2+1;&lt;/P&gt;
&lt;P&gt;q3=q3+1;&lt;/P&gt;
&lt;P&gt;q4=q4+1;&lt;/P&gt;
&lt;P&gt;*(skip the one you don't want to shift);&lt;/P&gt;
&lt;P&gt;q6=q6+1;&lt;/P&gt;
&lt;P&gt;q7=q7+1;&lt;/P&gt;
&lt;P&gt;q8=q8+1;&lt;/P&gt;
&lt;P&gt;q9=q9+1;&lt;/P&gt;
&lt;P&gt;q10=q10+1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;keeping it simple is the best way to go.&amp;nbsp; Try searching for a bug involving a particular variable that doesn't appear in your code because you used some programming short cut unique to some language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 22:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362899#M85789</guid>
      <dc:creator>rickpaulos</dc:creator>
      <dc:date>2017-05-30T22:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362902#M85790</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@SUNY_Maggie wrote:&lt;BR /&gt;Hi Reeza, missing imputation and scoring program was provided to me by the author of the methodology. And i was trying to fit my data to the program provided. Now I'm willing to modify the program to the data, not other way around.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Modifying your data to fit a standard program is a great reason to shift your data. You just need to explain things sometimes because otherwise it doesn't make sense to us, in terms of best practice. You can also just ignore us &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 22:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362902#M85790</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-30T22:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362915#M85796</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Reeza Thanks a lot.&lt;/P&gt;&lt;P&gt;Trusted Advosor's suggestion made the standard program fit to my data better. Below code is (after suggestion applied) to score the questionnaire responses using 0-100 scale. I need someone to reassure with me on the program to be sure. Would you please look at it especially beyong /*Attention*/ mark? It makes sense to me, however, resulting data has many negative values (see attached csv).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WANT; set HAVE;
ARRAY PFI(10) PF01-PF10;
DO I = 1 TO 10;
PFMEAN = MEAN(OF PFI(I));
IF PFI(I)= . THEN PFI(I) = PFMEAN;
END;&lt;BR /&gt;/*Attention*/
PFNUM = N(OF PF01-PF10);
IF PFNUM GE 5 THEN RAWPF = SUM(OF PF01-PF10);
PF = ((RAWPF - 10)/(30-10)) * 100;
LABEL  PF = 'PF SCORING (0-100)'
       RAWPF = 'PF ITEM SUMMARY';
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 23:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362915#M85796</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-30T23:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362916#M85797</link>
      <description>&lt;LI-CODE lang="sas"&gt;DO I &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; TO &lt;SPAN class="token number"&gt;10&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
PFMEAN &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;MEAN&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;OF PFI&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;I&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;IF&lt;/SPAN&gt; PFI&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;I&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;THEN&lt;/SPAN&gt; PFI&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;I&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; PFMEAN&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
END&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That portion doesn't make sense. Mean(of pf(I)) is just going to be that number, the mean of a single value is the value.&lt;/P&gt;
&lt;P&gt;Then the reassignment isn't going to work. Also, replacing missing with mean is a naive way to impute missing values and is probably one of the worst. Don't do it. Look at other imputation methods.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be looking to do something like the following but to be honest, working off code without knowing the actual intention is guesswork. It's better to evaluate the logic process and see if the code matches that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;pfmean = mean (of pf(*));

do i=1 to 10; *You shouldn't do this but if you do this is the way to do it;
if pf(i)=. then pf(i)=pfmean;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is also concerning because it calculates the sum&amp;nbsp;of a variable number of values and then treats it the same, wether there's 6 or 10 values. Without understanding context this seems dangerous.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF PFNUM GE 5 THEN RAWPF = SUM(OF PF01-PF10);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 00:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362916#M85797</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-31T00:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362918#M85798</link>
      <description>Thanks a lot. I'll study the program. Great suggestions here to keep in mind.</description>
      <pubDate>Wed, 31 May 2017 00:57:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362918#M85798</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-31T00:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362934#M85804</link>
      <description>Could also get away with ...&lt;BR /&gt;&lt;BR /&gt;inc(i) + 1;</description>
      <pubDate>Wed, 31 May 2017 02:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362934#M85804</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2017-05-31T02:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362949#M85808</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, what did you mean by historical?</description>
      <pubDate>Wed, 31 May 2017 05:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362949#M85808</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-05-31T05:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add constant value to all numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362950#M85809</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@SUNY_Maggie wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Very interesting.&lt;/P&gt;
&lt;P&gt;Zeros indicate "no, my physical activity is not limited" so is not missing. Assigning the column mean (mean(PF:)) would reflect in all study subjects' average versus imputing one's own responses' MEAN(OF PF01-PF10)?&amp;nbsp; Otherwise,&amp;nbsp;average of same item(question) mean (PF01) instead taking average of different questions mean(PF01-PF10) makes sense to me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is incorrect and shows a misunderstanding of how mean() function works. You should test this thoroughly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I meant 'hostorical' as in previous code used in history, ie code used to analyze results last year. A similar rationale can be applied to using a macro. It's easier to modify the data to fit a macro than to rewrite the macro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 05:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-constant-value-to-all-numeric-variables/m-p/362950#M85809</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-31T05:51:37Z</dc:date>
    </item>
  </channel>
</rss>

