<?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: Reading a missing value from a CSV file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631697#M187184</link>
    <description>&lt;P&gt;$CHAR in-format.&amp;nbsp; However missing character variable should be blank not dot.&amp;nbsp; Dot is not missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;34         data _null_;
35            infile cards dsd;
36            input a:$char12. b c;
37            put (_all_)(=);
38            cards;

a=. b=1 c=2
a=abc b=. c=.&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 12 Mar 2020 20:16:41 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2020-03-12T20:16:41Z</dc:date>
    <item>
      <title>Reading a missing value from a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631692#M187183</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am reading a missing value dot(.) for one of the variable(Charecter) in csv file.&amp;nbsp; SAS is converting it as blank ('') in the output dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i preserve dot(.) in the output .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are the details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;csv file :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;12345|2-K|Mr.|David|WHITE|.|Y|09/03/2018|.|Australia/Sydney&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Program&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;data work.W5RD4PZ5 ;&lt;BR /&gt;infile "/sas/saswork/nag/CONTACTS_20200313_01.csv" lrecl = 1024 delimiter = '|' dsd missover firstobs = 1;&lt;BR /&gt;attrib ID length = $30 format = $30. informat = $30.;&lt;BR /&gt;attrib CONTACTREF length = $20 format = $20. informat = $20.;&lt;BR /&gt;attrib TITLE1 length = $20 format = $20. informat = $20.;&lt;BR /&gt;attrib GIVENNAME length = $100 format = $100. informat = $100.;&lt;BR /&gt;attrib FAMILYNAME length = $100 format = $100. informat = $100.;&lt;BR /&gt;attrib COMPANYNAME length = $200 format = $200. informat = $200.;&lt;BR /&gt;attrib ISEXTERNALLYMAINTAINED length = $1 format = $1. informat = $1.;&lt;BR /&gt;attrib LASTMODIFIED length = $20 format = $20. informat = $20.;&lt;BR /&gt;attrib MIDDLENAME length = $100 format = $100. informat = $100.;&lt;BR /&gt;attrib TIMEZONE1 length = $40 format = $40. informat = $40.;&lt;BR /&gt;input ID CONTACTREF TITLE1 GIVENNAME FAMILYNAME COMPANYNAME ISEXTERNALLYMAINTAINED LASTMODIFIED MIDDLENAME TIMEZONE1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Output :&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the above file , Variables Companyname and Middlename are having values as dot(.) but in the ouput dataset it is showing as blank(''). How can we retain (.) in the output .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 19:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631692#M187183</guid>
      <dc:creator>dsadsad</dc:creator>
      <dc:date>2020-03-12T19:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a missing value from a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631697#M187184</link>
      <description>&lt;P&gt;$CHAR in-format.&amp;nbsp; However missing character variable should be blank not dot.&amp;nbsp; Dot is not missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;34         data _null_;
35            infile cards dsd;
36            input a:$char12. b c;
37            put (_all_)(=);
38            cards;

a=. b=1 c=2
a=abc b=. c=.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631697#M187184</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-03-12T20:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a missing value from a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631734#M187196</link>
      <description>&lt;P&gt;A typically constructed CSV file would have NO value for a 'missing'. The csv would look like&lt;/P&gt;
&lt;PRE&gt;Abc,,123&lt;/PRE&gt;
&lt;P&gt;To have the second value as missing.&lt;/P&gt;
&lt;P&gt;SAS however will read a . as missing, as you have discovered.&lt;/P&gt;
&lt;PRE&gt;data example;
   infile datalines dlm=',' dsd;
   informat x y z $5.;
   input x y z;
datalines;
abc,,456
brd,.,ghq
;&lt;/PRE&gt;
&lt;P&gt;You can force reading the dot with a custom informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
invalue $keepdot 
'.'='.'
other = _same_;
run;
data example;
   infile datalines dlm=',' dsd;
   informat x y z $keepdot3.;
   input x y z;
datalines;
abc,,456
brd,.,ghq
;&lt;/PRE&gt;
&lt;P&gt;Caveat: there may be issues getting lengthy variables read as this doesn't use a default length. You could assign default length in the INVALUE statement for the longest actual expected variable value you expect the dots to occur in and then use the LENGTH attribute to keep from having the shorter values end up with longer values. There might actually be some playing around needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course is you have NO actual blanks in the data source you could assign the dot as the value, or create a format depending on use.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 23:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-missing-value-from-a-CSV-file/m-p/631734#M187196</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-12T23:09:31Z</dc:date>
    </item>
  </channel>
</rss>

