<?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: Replace missing values with 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111720#M259039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi loredana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to the SAS Documentation, the MISSING system option does not replace missing values in numeric variables but instead "&lt;STRONG&gt;Specifies the character to print for missing numeric values&lt;/STRONG&gt;." so I think that the correct solution for this request would be to use the same approach used to replace the character variables with the coalesce function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &lt;STRONG&gt;"database name&lt;/STRONG&gt;";&amp;nbsp; /*for missing character variables, write this code as it is except the "database name" thing */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &lt;STRONG&gt;"database name";&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array ch(*) _character_;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array nm(*) _numeric_ ;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _n_ = 1 to dim(ch);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ch(_n_) = coalescec(ch(_n_), '0');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt; do _n_ = 1 to dim(nm);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nm(_n_) = coalesce(nm(_n_),0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jun 2014 15:22:16 GMT</pubDate>
    <dc:creator>CTorres</dc:creator>
    <dc:date>2014-06-27T15:22:16Z</dc:date>
    <item>
      <title>Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111714#M259033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;I have a dataset which I have recieved from someone. I donot want to open it and dont know how many columns it have, I want to replace missing values with 0 in each column in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 05:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111714#M259033</guid>
      <dc:creator>NishunkSaxena</dc:creator>
      <dc:date>2013-06-19T05:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111715#M259034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc stdize data=x reponly missing=0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 06:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111715#M259034</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-06-19T06:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111716#M259035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but this Stdize works only on Numeric values not on Character missing values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 09:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111716#M259035</guid>
      <dc:creator>NishunkSaxena</dc:creator>
      <dc:date>2013-06-19T09:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111717#M259036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any specific reason for not opening the table? :smileyconfused:&lt;/P&gt;&lt;P&gt;One way is to assign your column values to two arrays (one numeric - _NUMERIC_, and one char _CHARACTER_).&lt;/P&gt;&lt;P&gt;Then loop through the arrays and do coalesce/coalescec using 0/'0'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 11:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111717#M259036</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-06-19T11:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111718#M259037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Zero is a number.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 12:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111718#M259037</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-06-19T12:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111719#M259038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;options missing = '0';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*for missing numeric variables*/&lt;/P&gt;&lt;P&gt;data &lt;STRONG&gt;"database name"&lt;/STRONG&gt;;&amp;nbsp; /*for missing character variables, write this code as it is except the &lt;STRONG&gt;"database name"&lt;/STRONG&gt; thing */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &lt;STRONG&gt;"database name"&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array ch(*) _character_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _n_ = 1 to dim(ch);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ch(_n_) = coalescec(ch(_n_), '0');&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: Although you've replaced all missing character values with 0, this value will be considered a character and not the numeric value 0. It is impossible for a character variable to contain both character and numeric values at once. If you truly need the numeric 0 in the character variable you should convert the character variables to numeric ones by multiplying them by 1. Ex: new_charvariable = 1*charvariable;&lt;/P&gt;&lt;P&gt;Good luck and tell us if you've solved the problem &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 14:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111719#M259038</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2013-06-19T14:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111720#M259039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi loredana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to the SAS Documentation, the MISSING system option does not replace missing values in numeric variables but instead "&lt;STRONG&gt;Specifies the character to print for missing numeric values&lt;/STRONG&gt;." so I think that the correct solution for this request would be to use the same approach used to replace the character variables with the coalesce function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &lt;STRONG&gt;"database name&lt;/STRONG&gt;";&amp;nbsp; /*for missing character variables, write this code as it is except the "database name" thing */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &lt;STRONG&gt;"database name";&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array ch(*) _character_;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array nm(*) _numeric_ ;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _n_ = 1 to dim(ch);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ch(_n_) = coalescec(ch(_n_), '0');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt; do _n_ = 1 to dim(nm);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nm(_n_) = coalesce(nm(_n_),0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 15:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111720#M259039</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-06-27T15:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replace missing values with 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111721#M259040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right. "options missing =" works the exact way "format" does, only global.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 15:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-missing-values-with-0/m-p/111721#M259040</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-06-27T15:27:33Z</dc:date>
    </item>
  </channel>
</rss>

