<?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 Import CSV file and keep the period, not treat period as missing value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-CSV-file-and-keep-the-period-not-treat-period-as-missing/m-p/940266#M369080</link>
    <description>&lt;P&gt;How to import the attached csv files and keep the "." , these is just the sample data and it delimited by "|" and contain a value "N|A"&lt;/P&gt;&lt;PRE&gt;"VAR1"|"VAR2"|"VAR3"
"(-)"|"NA"|"A"
"-"|"N|A"|"B"
"."|""|"C"
""|"na"|"D"&lt;/PRE&gt;&lt;P&gt;The below code will convert the "." as missing value, but&amp;nbsp; I want the value VAR1 in row 3 is "."&lt;/P&gt;&lt;PRE&gt;options missing="*";
proc import datafile="test.csv"
    out=t1
    dbms=csv
    replace;
    delimiter='|';
    getnames=yes;
run;

data t2;
    infile "test.csv" delimiter='|' dsd flowover firstobs=2 missover /*truncover*/;
    input VAR1 :$20. VAR2 :$10.;
run;&lt;/PRE&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2024 11:29:46 GMT</pubDate>
    <dc:creator>enki37</dc:creator>
    <dc:date>2024-08-21T11:29:46Z</dc:date>
    <item>
      <title>Import CSV file and keep the period, not treat period as missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-CSV-file-and-keep-the-period-not-treat-period-as-missing/m-p/940266#M369080</link>
      <description>&lt;P&gt;How to import the attached csv files and keep the "." , these is just the sample data and it delimited by "|" and contain a value "N|A"&lt;/P&gt;&lt;PRE&gt;"VAR1"|"VAR2"|"VAR3"
"(-)"|"NA"|"A"
"-"|"N|A"|"B"
"."|""|"C"
""|"na"|"D"&lt;/PRE&gt;&lt;P&gt;The below code will convert the "." as missing value, but&amp;nbsp; I want the value VAR1 in row 3 is "."&lt;/P&gt;&lt;PRE&gt;options missing="*";
proc import datafile="test.csv"
    out=t1
    dbms=csv
    replace;
    delimiter='|';
    getnames=yes;
run;

data t2;
    infile "test.csv" delimiter='|' dsd flowover firstobs=2 missover /*truncover*/;
    input VAR1 :$20. VAR2 :$10.;
run;&lt;/PRE&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 11:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-CSV-file-and-keep-the-period-not-treat-period-as-missing/m-p/940266#M369080</guid>
      <dc:creator>enki37</dc:creator>
      <dc:date>2024-08-21T11:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV file and keep the period, not treat period as missing value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-CSV-file-and-keep-the-period-not-treat-period-as-missing/m-p/940268#M369081</link>
      <description>&lt;P&gt;There is no need to "import" a CSV file.&amp;nbsp; Just write the data step needed to READ the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid the normal conversion of a single period to a missing value you need to read the value using the $CHAR informat instead of the default $ informat.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t2;
   infile "test.csv" dsd dlm='|' truncover firstobs=2 ;
   input VAR1 :$char20. VAR2 :$char10. var3 :$char1.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;Obs    VAR1    VAR2    var3

 1     (-)     NA       A
 2     -       N|A      B
 3     .                C
 4             na       D
&lt;/PRE&gt;
&lt;P&gt;PS You can only have one of FLOWOVER MISSOVER and TRUNCOVER.&amp;nbsp; The last one listed will "win".&amp;nbsp; The default is FLOWOVER.&amp;nbsp; You almost never want the strange behavior of MISSOVER.&amp;nbsp; So use TRUNCOVER when reading a delimited text file that might have an empty value for the last value on the line.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 12:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-CSV-file-and-keep-the-period-not-treat-period-as-missing/m-p/940268#M369081</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-21T12:07:18Z</dc:date>
    </item>
  </channel>
</rss>

