<?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: proc import problem with column length in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465225#M118659</link>
    <description>&lt;P&gt;yeah, by revising log code, the column length could be adjusted. Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 25 May 2018 21:40:20 GMT</pubDate>
    <dc:creator>mlin828</dc:creator>
    <dc:date>2018-05-25T21:40:20Z</dc:date>
    <item>
      <title>proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284785#M58115</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I would like to import csv to sas table but I have problem with column length. It seems that column data type(length) is&amp;nbsp;set according to the first row.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example the csv file(name.csv) looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    +---------+-------------+
    | cust_id | Name        | 
    +---------+-------------+
    |       1 | King        | 
    |       2 | Smith       | 
    |       3 | Brown       | &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I will use this code for import:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile="\\inputs\name.csv" &lt;BR /&gt; out=lib.tablename dbms=csv replace;&lt;BR /&gt; getnames=yes;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the result in the lib.tablename is:&lt;/P&gt;
&lt;PRE&gt;    +---------+-------------+
    | cust_id | Name        | 
    +---------+-------------+
    |       1 | King        | 
    |       2 | Smit        | 
    |       3 | Brow        | &lt;/PRE&gt;
&lt;P&gt;The last letter in a&amp;nbsp;second and third row is deleted... Is there any way how to format column in proc import? Or may I use something else than proc import?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 09:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284785#M58115</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2016-07-15T09:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284786#M58116</link>
      <description>&lt;P&gt;There is an option in &amp;nbsp;proc import. Try to add before the run; GUESSINGROWS=X. This means that the format should be applied after X rows readed&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 09:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284786#M58116</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2016-07-15T09:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284794#M58118</link>
      <description>&lt;P&gt;Thank you very much. It works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 10:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284794#M58118</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2016-07-15T10:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284802#M58121</link>
      <description>&lt;P&gt;As an alternaitve, take responsibility for setting the data strcuture yourself - being the best person to know what that should be like, and don't rely on SAS proc import to guess what the data should look like. &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  infile "&amp;lt;your csv file&amp;gt;.csv";
  length var1 $200 var2 8;
  format var1 $200 var2 8.;
  informat var1 $200 var2 8.;
  input var1 $ var2;
run;&lt;/PRE&gt;
&lt;P&gt;You can get the actual program generated by proc import from your log, then you can modify that to meet your needs (or modify it to your data import agreement which details the specification of the imported data). &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 10:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/284802#M58121</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-15T10:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465224#M118658</link>
      <description>&lt;P&gt;This method does not work for me, the log said unsuccessful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code is&amp;nbsp;as following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile="\\sf......&amp;nbsp;..csv"&lt;BR /&gt;out=adeg DBMS=csv replace;&lt;BR /&gt;GUESSINGROWS=2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 21:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465224#M118658</guid>
      <dc:creator>mlin828</dc:creator>
      <dc:date>2018-05-25T21:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465225#M118659</link>
      <description>&lt;P&gt;yeah, by revising log code, the column length could be adjusted. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 21:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465225#M118659</guid>
      <dc:creator>mlin828</dc:creator>
      <dc:date>2018-05-25T21:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc import problem with column length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465226#M118660</link>
      <description>&lt;P&gt;revised the code to gussingrows=42 , then it works, thanks! it needs to be the row which has longest word, got it!&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 21:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-problem-with-column-length/m-p/465226#M118660</guid>
      <dc:creator>mlin828</dc:creator>
      <dc:date>2018-05-25T21:46:57Z</dc:date>
    </item>
  </channel>
</rss>

