<?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: turning null into 0 when reading from files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912649#M359762</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you have subject matter knowledge that allows you to know that null should be treated as zeros, do NOT do this. Nulls should be treated as missing without such subject matter knowledge.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2024 12:06:17 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-01-23T12:06:17Z</dc:date>
    <item>
      <title>turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912591#M359748</link>
      <description>&lt;P&gt;&amp;nbsp;do you know if sas automatically turn null into 0 in any case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in what I see, when sas read in from files other than sas dataset&lt;/P&gt;
&lt;P&gt;it turn null into zero&lt;/P&gt;
&lt;P&gt;why is this??&lt;/P&gt;
&lt;P&gt;our files are iff, lets say it is some text file&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 04:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912591#M359748</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2024-01-23T04:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912596#M359749</link>
      <description>&lt;P&gt;Assuming by "null", you mean a blank character, and assuming you are reading values via the INPUT statement, then SAS does NOT by default convert a null into a zero (we are discussing numeric variables here).&amp;nbsp; Instead, the numeric variable is assigned a special missing value (typically printed out as a naked period), when read from a "null".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I.e. this program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t;
  input @1 x 1.  @3 y 1. ;
  put (_all_) (=);
datalines;
1 1
2  
  3
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;produces this on the sas log (note the dots).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x=1 y=1
x=2 y=.
x=. y=3
NOTE: The data set WORK.T has 3 observations and 2 variables.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A missing value, by default, is not treated as a zero, although there are some SAS functions and statements that can treat missing values as zeroes.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 05:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912596#M359749</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-01-23T05:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912599#M359750</link>
      <description>&lt;P&gt;If a data step is used to read the files, a custom informat could change missing (aka null) to 0 automatically.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 07:52:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912599#M359750</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2024-01-23T07:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912608#M359752</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please share an example data step with instream data (e.g., &lt;FONT face="courier new,courier"&gt;datalines&lt;/FONT&gt;), so that we can replicate the issue to assist with a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending upon how you are reading in the data and viewing it, the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/n0qamf3yfjtwzhn1ran6xwblnlea.htm" target="_blank" rel="noopener"&gt;missing= option&lt;/A&gt;&amp;nbsp;might be worth checking, as the page says "Specifies the character to print for missing numeric values."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 08:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912608#M359752</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2024-01-23T08:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912618#M359755</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;do you know if sas automatically turn null into 0 in any case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in what I see, when sas read in from files other than sas dataset&lt;/P&gt;
&lt;P&gt;it turn null into zero&lt;/P&gt;
&lt;P&gt;why is this??&lt;/P&gt;
&lt;P&gt;our files are iff, lets say it is some text file&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is your current setting for the MISSING option? You can check by running this code:&lt;/P&gt;
&lt;PRE&gt;Proc options option=missing;
run;&lt;/PRE&gt;
&lt;P&gt;The output in the log will look something like:&lt;/P&gt;
&lt;PRE&gt;49   Proc options option=missing;
50   run;

    SAS (r) Proprietary Software Release 9.4 

 MISSING=.         Specifies the character to print for missing numeric
                   values.

&lt;/PRE&gt;
&lt;P&gt;If your result shows Missing=0 then your setting is displaying zero when the value is missing.&lt;/P&gt;
&lt;P&gt;Otherwise show the code you are using to read one of these files and a few lines of the text file data that exhibit this behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 10:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912618#M359755</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-01-23T10:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912649#M359762</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you have subject matter knowledge that allows you to know that null should be treated as zeros, do NOT do this. Nulls should be treated as missing without such subject matter knowledge.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 12:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912649#M359762</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-23T12:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912810#M359792</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt; please mark one of the above replies as correct, whichever one you think is correct.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 11:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912810#M359792</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-24T11:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: turning null into 0 when reading from files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912858#M359816</link>
      <description>I was so hoping someone would mention that 'missing information' is rarely equal to a numeric 'zero'. Thank you, Paige, for calling this out! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 24 Jan 2024 16:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/turning-null-into-0-when-reading-from-files/m-p/912858#M359816</guid>
      <dc:creator>MelissaM</dc:creator>
      <dc:date>2024-01-24T16:39:50Z</dc:date>
    </item>
  </channel>
</rss>

