<?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: error message for proc import CSV file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916029#M360884</link>
    <description>Thanks for the response Kurt&lt;BR /&gt;1. the header is in Line 1&lt;BR /&gt;2. i'm not familiar with this. How do I check unexpected end-of-line characters? Do I copy and paste the excel values onto Notepad++? If so, what do I look for ?&lt;BR /&gt;&lt;BR /&gt;thank you very much</description>
    <pubDate>Wed, 14 Feb 2024 08:57:18 GMT</pubDate>
    <dc:creator>HitmonTran</dc:creator>
    <dc:date>2024-02-14T08:57:18Z</dc:date>
    <item>
      <title>error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916012#M360876</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an error message importing CSV file, I couldn't find a solution in this forum, please help, thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%web_drop_table(WORK.IMPORT1);


FILENAME REFFILE "&amp;amp;analydir/survey.csv"    ;

PROC IMPORT DATAFILE=REFFILE
	DBMS=csv
	OUT=WORK.IMPORT1;
	GETNAMES=YES;
RUN;

PROC CONTENTS DATA=WORK.IMPORT1; RUN;


%web_open_table(WORK.IMPORT1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;log message:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HitmonTran_0-1707897282882.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93684iBCB2B8291797D709/image-size/large?v=v2&amp;amp;px=999" role="button" title="HitmonTran_0-1707897282882.png" alt="HitmonTran_0-1707897282882.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HitmonTran_1-1707897310849.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93685i4C7391C415E253C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="HitmonTran_1-1707897310849.png" alt="HitmonTran_1-1707897310849.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;exel file:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HitmonTran_0-1707900678777.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93692i5F30B5EFF3D420EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="HitmonTran_0-1707900678777.png" alt="HitmonTran_0-1707900678777.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;when opened with Notepad ++:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HitmonTran_0-1707903234218.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93693i3A413FB8351EE376/image-size/large?v=v2&amp;amp;px=999" role="button" title="HitmonTran_0-1707903234218.png" alt="HitmonTran_0-1707903234218.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 09:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916012#M360876</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2024-02-14T09:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916016#M360877</link>
      <description>&lt;P&gt;What does the documentation of the file say about the columns?&lt;/P&gt;
&lt;P&gt;I see two possible issues:&lt;/P&gt;
&lt;P&gt;- the header is in line 2 instead of line 1&lt;/P&gt;
&lt;P&gt;- you have unexpected end-of-line characters (e.g. CR instead of CRLF or LF)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at your file with a programmer's text editor (I recommend Notepad++) to see more.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 08:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916016#M360877</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-02-14T08:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916029#M360884</link>
      <description>Thanks for the response Kurt&lt;BR /&gt;1. the header is in Line 1&lt;BR /&gt;2. i'm not familiar with this. How do I check unexpected end-of-line characters? Do I copy and paste the excel values onto Notepad++? If so, what do I look for ?&lt;BR /&gt;&lt;BR /&gt;thank you very much</description>
      <pubDate>Wed, 14 Feb 2024 08:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916029#M360884</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2024-02-14T08:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916030#M360885</link>
      <description>&lt;P&gt;This is a csv file, which means it's text.&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;TEXT.&lt;/STRONG&gt;&lt;/U&gt; Opening it with Excel will only show you what Excel&amp;nbsp;&lt;EM&gt;thinks&lt;/EM&gt; is in the file, not it's real content.&lt;/P&gt;
&lt;P&gt;A good editor can show you how the lines are terminated (CR character for MacOS, LF character for UNIX, CRLF combination for Windows).&lt;/P&gt;
&lt;P&gt;Once again,&amp;nbsp;&lt;U&gt;what does the documentation of the file say&lt;/U&gt;?&lt;/P&gt;
&lt;P&gt;To inspect it, right-click on it in Explorer, select "Open with", and then the editor program you have installed.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 09:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916030#M360885</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-02-14T09:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916032#M360886</link>
      <description>Thanks Kurt,&lt;BR /&gt;&lt;BR /&gt;I believe it says UNIX(LF) UTF-8.&lt;BR /&gt;&lt;BR /&gt;I also updated my post and uploaded the screenshot of Notepad ++</description>
      <pubDate>Wed, 14 Feb 2024 09:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916032#M360886</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2024-02-14T09:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916034#M360888</link>
      <description>&lt;P&gt;So you have stuff in there which overwhelms PROC IMPORT.&lt;/P&gt;
&lt;P&gt;Start with an INFILE statement like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile "path_to_file" termstr=LF dlm="," truncover firstobs=2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Create usable (letters, digits, underlines, max length 32, can't start with a digit) names for your variables to use in the INPUT statement.&lt;/P&gt;
&lt;P&gt;In your INPUT statement, use appropriate(*) informats with a colon modifier so that the informats do not override the delimiter.&lt;/P&gt;
&lt;P&gt;For variables which need it, assign proper(*) formats with a FORMAT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*) the information for this has to come from the documentation of the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 10:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916034#M360888</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-02-14T10:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: error message for proc import CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916044#M360893</link>
      <description>&lt;P&gt;So from your PHOTOGRAPH of the TEXT in the CSV file it looks like the header line has been split into 3 lines.&amp;nbsp; That will mess up PROC IMPORT's ability to make reasonable guesses about what type of data is in each column.&amp;nbsp; You will probably want to set GETNAMES to NO instead of YES and tell PROC IMPORT to start reading on line 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the file seems to have more than 20 lines, so you will want to tell PROC IMPORT to use a larger value for the GUESSINGROWS option.&amp;nbsp; If you set it to MAX then it will check the whole file before deciding how to define and read each variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to really see what is in the file the way SAS sees it just run some SAS code.&amp;nbsp; For example this program will dump the first 10 lines of the file to the SAS log.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile reffile obs=10;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 13:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-message-for-proc-import-CSV-file/m-p/916044#M360893</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-14T13:08:27Z</dc:date>
    </item>
  </channel>
</rss>

