<?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: problem with importing csv file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491906#M129156</link>
    <description>&lt;P&gt;The picture on the left is NOT a CSV file. It appears to be some type of spreadsheet software. A CSV file is just a text file.&lt;/P&gt;
&lt;P&gt;But looking at the values in the SAS dataset is really looks like you do not have a "real" CSV (comma separated values) but instead a delimited file where the delimiter is a semi-colon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest solution is to just tell SAS that your delimiter is a semi-colon instead of a comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for three columns it is even easier (and you will have complete control) if you just write the data step your self.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  infile 'myfile.txt' dsd dlm=';' firstobs=2 truncover ;
  input group x1 x2 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 02 Sep 2018 17:21:50 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-09-02T17:21:50Z</dc:date>
    <item>
      <title>problem with importing csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491902#M129152</link>
      <description>&lt;P&gt;Hello, everyone&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am really struggling with importing a .csv file into SAS. The dataset has 3 variables, but when it imports, SAS says it has 1 variable. It puts 3 columns into 1. I tried putting in the data with a cards statement, but it gave me errors as there is had too many lines. I attached a picture of what the data looks like in Excel and what it looks like in SAS. The data originally had commas as decimals and I changed it to full stops but the problem still occurs. Please help me out. (I imported it by clicking "import data" in "file"). Thank you so much&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel data.PNG" style="width: 300px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22944i6AB632D7742029C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="excel data.PNG" alt="excel data.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas data.PNG" style="width: 251px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22945i7379046C10D1141B/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas data.PNG" alt="sas data.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Sep 2018 16:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491902#M129152</guid>
      <dc:creator>clarke</dc:creator>
      <dc:date>2018-09-02T16:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: problem with importing csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491906#M129156</link>
      <description>&lt;P&gt;The picture on the left is NOT a CSV file. It appears to be some type of spreadsheet software. A CSV file is just a text file.&lt;/P&gt;
&lt;P&gt;But looking at the values in the SAS dataset is really looks like you do not have a "real" CSV (comma separated values) but instead a delimited file where the delimiter is a semi-colon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest solution is to just tell SAS that your delimiter is a semi-colon instead of a comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for three columns it is even easier (and you will have complete control) if you just write the data step your self.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  infile 'myfile.txt' dsd dlm=';' firstobs=2 truncover ;
  input group x1 x2 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Sep 2018 17:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491906#M129156</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-02T17:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: problem with importing csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491914#M129163</link>
      <description>&lt;P&gt;Try PROC IMPORT with GUESSINGROWS=MAX and set the delimiter to a semi colon.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you had a french source file which uses a ; instead of comma, and a comma where a decimal would be instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Tom mentioned to work with a CSV file you're best off opening it with a text editor, NOT Excel because Excel interprets the data to present it, not always correctly but it doesn't give you the correct information to import it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will take a bit longer to run than Tom's solution but should work as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import out=want datafile="path to csv" dbms=dlm replace;
delimiter=';'; guessingrows=max;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230090"&gt;@clarke&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, everyone&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am really struggling with importing a .csv file into SAS. The dataset has 3 variables, but when it imports, SAS says it has 1 variable. It puts 3 columns into 1. I tried putting in the data with a cards statement, but it gave me errors as there is had too many lines. I attached a picture of what the data looks like in Excel and what it looks like in SAS. The data originally had commas as decimals and I changed it to full stops but the problem still occurs. Please help me out. (I imported it by clicking "import data" in "file"). Thank you so much&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel data.PNG" style="width: 300px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22944i6AB632D7742029C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="excel data.PNG" alt="excel data.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas data.PNG" style="width: 251px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22945i7379046C10D1141B/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas data.PNG" alt="sas data.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Sep 2018 17:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491914#M129163</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-02T17:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: problem with importing csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491916#M129165</link>
      <description>&lt;P&gt;In a data step, use the semicolon as a delimiter, and the commax. informat for the numeric variables.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Sep 2018 18:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-importing-csv-file/m-p/491916#M129165</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-02T18:14:11Z</dc:date>
    </item>
  </channel>
</rss>

