<?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: Import issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402846#M97864</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;.... as the column in the data file is not fix from file to file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is what needs fixing. Once a certain action has to be repeated consistently, a solid agreement on data structures is mandatory.&lt;/P&gt;
&lt;P&gt;Proc import relies on guesses and&amp;nbsp;&lt;EM&gt;cannot&lt;/EM&gt; produce consistent results.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2017 16:45:44 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-10-10T16:45:44Z</dc:date>
    <item>
      <title>Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402588#M97783</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I import a csv file into SAS using the code below. in 1 cell, the csv value is 2000 (no comma) but in SAS, it become 2 (and become character). No error notice show up.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile="...csv"
out=Payroll dbms=csv replace;
getnames=yes;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So I try the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Payroll ;
infile "&amp;amp;data_path.\Payroll Register Data Export - &amp;amp;month..csv"
dlm=','  dsd truncover firstobs=2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and the value turns out correct 2000 (best12)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(the first few row in the data is blank but many other colum return correct value)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder why it is like that and what method of import abve is more reliable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I try to save as this few row into a seperate file in order to put it here so you can try but this new file works fine with both approaches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 03:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402588#M97783</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-10-10T03:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402592#M97785</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Looks to me like you might have some hidden characters or the like in your source file - especially because you can't even copy/paste the rows into another file to replicate the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you could do:&lt;/P&gt;
&lt;P&gt;-&amp;nbsp; Open the file with Notepad ++ or similar and search for non-print characters (View / Show Symbol / Show all characters)&lt;/P&gt;
&lt;P&gt;or...&lt;/P&gt;
&lt;P&gt;- Save your file under a different name, delete most of your rows/just leave a few including the one causing issues&lt;/P&gt;
&lt;P&gt;- Run your code on this new file and if the issue still exists then attach the file to your post so we can investigate&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 04:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402592#M97785</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-10T04:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402600#M97788</link>
      <description>&lt;P&gt;After your IMPORT step, check your log. See the FORMAT / INFORMAT applied for the variable in question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then compare it to your data step code and see the differences.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 04:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402600#M97788</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-10T04:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402602#M97790</link>
      <description>&lt;P&gt;Have you tried setting GUESSINGROWS to 100 in proc import?&lt;/P&gt;
&lt;P&gt;And: if you know in which line data starts, use DATAROW to tell it proc import.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 04:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402602#M97790</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-10-10T04:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402618#M97795</link>
      <description>&lt;P&gt;Concur with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;. Use an advanced editor like notepad++ to view the file (you can switch to hexadecimal display), so you can see what's really in there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or read the file with a brute-force method:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile "&amp;amp;data_path.\Payroll Register Data Export - &amp;amp;month..csv";
length my_line $200 my_hex_line $400;
input;
my_line = _infile_;
my_hex_line = put(my_line,$hex400.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then look at the hex display of the input. If necessary, expand the lengths.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 06:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402618#M97795</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-10T06:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402819#M97858</link>
      <description>&lt;P&gt;Thanks for helping me.&lt;/P&gt;
&lt;P&gt;Since this column has all cell blank above this error cell, What I do is to put number 1 in the first cell and SAS now CORRECTLY import the data.&lt;/P&gt;
&lt;P&gt;Does this give any clue as to what should I do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure what I should do since I have to use IMPORT as the column in the data file is not fix from file to file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HC&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 15:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402819#M97858</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-10-10T15:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402846#M97864</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;.... as the column in the data file is not fix from file to file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is what needs fixing. Once a certain action has to be repeated consistently, a solid agreement on data structures is mandatory.&lt;/P&gt;
&lt;P&gt;Proc import relies on guesses and&amp;nbsp;&lt;EM&gt;cannot&lt;/EM&gt; produce consistent results.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/402846#M97864</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-10T16:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/417854#M102637</link>
      <description>&lt;P&gt;Actually this helps a ton. I had this problem and when I saw your coment, I tried to put Guessingrows={value} and it worked wonder. I'd like to know what's the difference when I put the value 10000 vs 100 or any others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 20:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/417854#M102637</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2017-12-01T20:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Import issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/418074#M102688</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177650"&gt;@KrisDeng&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Actually this helps a ton. I had this problem and when I saw your coment, I tried to put Guessingrows={value} and it worked wonder. I'd like to know what's the difference when I put the value 10000 vs 100 or any others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It simply determines how may lines of the input file proc import will read to guess the data structure. So more lines may create a better result, but will also take longer, as proc import scans the file twice (once for guess, twice for actual read). But this only helps in &lt;EM&gt;guessing&lt;/EM&gt;, for consistent&amp;nbsp; results a properly written data step is the &lt;EM&gt;only&lt;/EM&gt; way to go.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 07:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-issue/m-p/418074#M102688</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-04T07:20:20Z</dc:date>
    </item>
  </channel>
</rss>

