<?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: Recoding Missing Numeric Values to 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529054#M144486</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. First off, &lt;STRONG&gt;do over array&lt;/STRONG&gt; is an implicit array. Most people would suggest not to use implicit array as it's been&amp;nbsp;&lt;STRONG&gt;deprecated.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&amp;nbsp;&lt;/STRONG&gt;The implicit array creates an automatic index variable _i_ in the PDV , however the index variable is not written to the output dataset.&lt;/P&gt;
&lt;P&gt;3. _numeric_ is a keyword for grouping all numeric variable as elements in your array "change". So once your array is declared at compile time, sas groups the num vars with a non scalar value for the array identifier.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. What actually happens is&lt;/P&gt;
&lt;P&gt;Your&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DO OVER CHANGE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; IF CHANGE=. THEN CHANGE=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; END;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;resolves to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;do _i_=1 to dim(change);&lt;/STRONG&gt; /*dim(change) is total number of num elements(vars) that's been grouped*/&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if change(_i_)=. then change(_i_)=0;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards!&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;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all. I was passed along a program that contains the following data step. It recodes ALL missing numeric values to 0.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;But I don't understand how it's doing it?&amp;nbsp; In particular I don't understand the keywords 'change', '_numeric_', and 'do over'.&amp;nbsp; Can anyone help me understand how this code works?&amp;nbsp; Any pointers would be most appreciated.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* RECODE ALL NUMBERIC MISSING VALUES FROM . TO 0 */
DATA WANT;
   SET HAVE;
   ARRAY CHANGE _NUMERIC_;
        DO OVER CHANGE;
            IF CHANGE=. THEN CHANGE=0;
        END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, do you feel this is a good way of doing this task or are there better alternatives?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jan 2019 14:41:03 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-01-22T14:41:03Z</dc:date>
    <item>
      <title>Recoding Missing Numeric Values to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529041#M144482</link>
      <description>&lt;P&gt;Hi all. I was passed along a program that contains the following data step. It recodes ALL missing numeric values to 0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I don't understand how it's doing it?&amp;nbsp; In particular I don't understand the keywords 'change', '_numeric_', and 'do over'.&amp;nbsp; Can anyone help me understand how this code works?&amp;nbsp; Any pointers would be most appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* RECODE ALL NUMBERIC MISSING VALUES FROM . TO 0 */
DATA WANT;
   SET HAVE;
   ARRAY CHANGE _NUMERIC_;
        DO OVER CHANGE;
            IF CHANGE=. THEN CHANGE=0;
        END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, do you feel this is a good way of doing this task or are there better alternatives?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 14:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529041#M144482</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-01-22T14:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding Missing Numeric Values to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529043#M144483</link>
      <description>&lt;P&gt;That way of doing it works.&lt;/P&gt;
&lt;P&gt;here is a link to the same code you have provided that has the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/td-p/41478" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/td-p/41478&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 14:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529043#M144483</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-01-22T14:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding Missing Numeric Values to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529054#M144486</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. First off, &lt;STRONG&gt;do over array&lt;/STRONG&gt; is an implicit array. Most people would suggest not to use implicit array as it's been&amp;nbsp;&lt;STRONG&gt;deprecated.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&amp;nbsp;&lt;/STRONG&gt;The implicit array creates an automatic index variable _i_ in the PDV , however the index variable is not written to the output dataset.&lt;/P&gt;
&lt;P&gt;3. _numeric_ is a keyword for grouping all numeric variable as elements in your array "change". So once your array is declared at compile time, sas groups the num vars with a non scalar value for the array identifier.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. What actually happens is&lt;/P&gt;
&lt;P&gt;Your&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DO OVER CHANGE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; IF CHANGE=. THEN CHANGE=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; END;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;resolves to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;do _i_=1 to dim(change);&lt;/STRONG&gt; /*dim(change) is total number of num elements(vars) that's been grouped*/&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if change(_i_)=. then change(_i_)=0;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards!&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;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all. I was passed along a program that contains the following data step. It recodes ALL missing numeric values to 0.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;But I don't understand how it's doing it?&amp;nbsp; In particular I don't understand the keywords 'change', '_numeric_', and 'do over'.&amp;nbsp; Can anyone help me understand how this code works?&amp;nbsp; Any pointers would be most appreciated.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* RECODE ALL NUMBERIC MISSING VALUES FROM . TO 0 */
DATA WANT;
   SET HAVE;
   ARRAY CHANGE _NUMERIC_;
        DO OVER CHANGE;
            IF CHANGE=. THEN CHANGE=0;
        END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, do you feel this is a good way of doing this task or are there better alternatives?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 14:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529054#M144486</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-22T14:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding Missing Numeric Values to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529057#M144488</link>
      <description>Wow. That's a very helpful explanation. That's so much for taking the time.</description>
      <pubDate>Tue, 22 Jan 2019 14:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529057#M144488</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-01-22T14:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding Missing Numeric Values to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529058#M144489</link>
      <description>&lt;P&gt;You are welcome. Have a nice day!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 14:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Missing-Numeric-Values-to-0/m-p/529058#M144489</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-22T14:47:13Z</dc:date>
    </item>
  </channel>
</rss>

