<?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: non numeric to replace 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685663#M207985</link>
    <description>Please do not change the code halfway without explanation. By reading using a character informat ($10. instead of 10.) you just changed the data type from numeric to character and any proposed solution may be all of sudden not applicable.</description>
    <pubDate>Tue, 22 Sep 2020 11:51:47 GMT</pubDate>
    <dc:creator>jklaverstijn</dc:creator>
    <dc:date>2020-09-22T11:51:47Z</dc:date>
    <item>
      <title>non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685605#M207953</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;i have one issue regarding the sas code in my data have licnum it contains sum non numeric values like . $ A so i want to substitute the non numeric values to 0 plz kindly share the solution for the below issue&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&amp;nbsp;&lt;/P&gt;&lt;P&gt;data licnum;&lt;/P&gt;&lt;P&gt;infile datalines;&lt;/P&gt;&lt;P&gt;input&amp;nbsp;@1 licno 10.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;12..994432&lt;/P&gt;&lt;P&gt;980..e221..&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data numchg;&lt;/P&gt;&lt;P&gt;set licnum;&lt;/P&gt;&lt;P&gt;if licno = . then licno = 0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;kindly give sum solution for the above issue and mainly it's a sasmainframe&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks $ Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rohit&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 07:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685605#M207953</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2020-09-22T07:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685608#M207954</link>
      <description>&lt;P&gt;Your code is not wrong. You just use one of the many possible ways of mapping a missing to 0. These are a few other options:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;data licnum;
infile datalines;
input @1 licno 10.;
/* Alternatives. Use one. */
licno = coalesce(licno, 0);
licno = sum(licno, 0);
if licno = . then licno = 0;
...
&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;-- Jan.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 07:51:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685608#M207954</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-09-22T07:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685612#M207956</link>
      <description>Hi jklaverstijn&lt;BR /&gt;thanks for the quick replay&lt;BR /&gt;but i got some issue wt you posted, below error i got kindly look it once&lt;BR /&gt;LICNO = COALESCE(LICNO, 0);&lt;BR /&gt;________&lt;BR /&gt;________&lt;BR /&gt;________&lt;BR /&gt;68&lt;BR /&gt;68&lt;BR /&gt;68&lt;BR /&gt;OR 68-185: The function COALESCE is unknown, or cannot be accessed. kindly plz give some solution for that one&lt;BR /&gt;Thanks &amp;amp; Regard&lt;BR /&gt;Rohit</description>
      <pubDate>Tue, 22 Sep 2020 08:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685612#M207956</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2020-09-22T08:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685620#M207962</link>
      <description>&lt;P&gt;Please do always (as in&lt;/P&gt;
&lt;P&gt;&lt;FONT size="6"&gt;&lt;STRONG&gt;ALWAYS!&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;) post the&amp;nbsp;&lt;U&gt;&lt;EM&gt;whole&lt;/EM&gt;&lt;/U&gt; log of a step, and do always (as in&lt;/P&gt;
&lt;P&gt;&lt;FONT size="6"&gt;&lt;STRONG&gt;ALWAYS!&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;) use this button for posting logs:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/E0BB18E7DAA53C21BC28740CEA0E38DA/responsive_peak/images/image_not_found.png" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;We always ask this not because we're extremely bored, but because only whole logs help in diagnosing problems, and the &amp;lt;/&amp;gt; window keeps the log as it is, without destroying the formatting.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 08:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685620#M207962</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-22T08:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685621#M207963</link>
      <description>&lt;P&gt;You must have a very old SAS version. Use one of the other suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 08:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685621#M207963</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-09-22T08:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685644#M207979</link>
      <description>HI KurtBremser,&lt;BR /&gt;Thanks for the Replay &amp;amp; sorry for what i posted, in the hurry manner i posted the hard code kindly ignore the mistake and give some of the solution above issue&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;Rohit</description>
      <pubDate>Tue, 22 Sep 2020 10:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685644#M207979</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2020-09-22T10:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685649#M207980</link>
      <description>&lt;P&gt;You already have more than one solution. If COALESCE() doesn't work for you, use one of the other suggested methods:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;LICNO = SUM(LICNO, 0);&lt;/PRE&gt;
&lt;P&gt;Or:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if LICNO = . then LICNO=0;&lt;/PRE&gt;
&lt;P&gt;You can put that in straight after the INPUT statement. No need for a second data step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 10:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685649#M207980</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-09-22T10:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685653#M207981</link>
      <description>Hi jklaverstijn&lt;BR /&gt;Thanks for the quick response you're code working good but my expected o/p was not yet came i will share the log code&lt;BR /&gt;&amp;lt; DATA NEWLIC;&lt;BR /&gt;INFILE DATALINES;&lt;BR /&gt;INPUT @1 LICNO $10.;&lt;BR /&gt;IF LICNO = . THEN LICNO = 4;&lt;BR /&gt;DATALINES;&lt;BR /&gt;203....412&lt;BR /&gt;...3300421&lt;BR /&gt;9955..032.&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT DATA = NEWLIC;&lt;BR /&gt;RUN;&lt;BR /&gt;&amp;gt;&lt;BR /&gt;below the output i got&lt;BR /&gt;+++++++++++++++++++++++&lt;BR /&gt;&lt;BR /&gt;Obs LICNO&lt;BR /&gt;&lt;BR /&gt;1 4&lt;BR /&gt;2 4&lt;BR /&gt;3 4&lt;BR /&gt;+++++++++++++++++++++++++++++&lt;BR /&gt;but my expected output was&lt;BR /&gt;2030000412&lt;BR /&gt;0003300421&lt;BR /&gt;9955000320&lt;BR /&gt;i want to substitute non numeric to 0 like above . is the non numeric so i replaced with 0 in manual way kindly share some some solution for above one&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;Rohit</description>
      <pubDate>Tue, 22 Sep 2020 11:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685653#M207981</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2020-09-22T11:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685654#M207982</link>
      <description>&lt;P&gt;Please share the log in the window that appears when you click on the &amp;lt;/&amp;gt; icon, as requested&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 11:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685654#M207982</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-22T11:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: non numeric to replace 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685663#M207985</link>
      <description>Please do not change the code halfway without explanation. By reading using a character informat ($10. instead of 10.) you just changed the data type from numeric to character and any proposed solution may be all of sudden not applicable.</description>
      <pubDate>Tue, 22 Sep 2020 11:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/non-numeric-to-replace-0/m-p/685663#M207985</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-09-22T11:51:47Z</dc:date>
    </item>
  </channel>
</rss>

