<?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: importing file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479396#M123735</link>
    <description>Is 27000 greater than 32767?&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 19 Jul 2018 06:56:42 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-07-19T06:56:42Z</dc:date>
    <item>
      <title>importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479357#M123713</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to import a file in SAS, when I use excel verson to import, it imports the variables as characters although they are all numeric and when I import it as a csv file, although it corrects this error but fails to import all the data.. I am unsure how to resolve tis issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Anum&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479357#M123713</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-19T02:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479359#M123714</link>
      <description>&lt;P&gt;what data are missing when you use csv? proc import generates code that you can then modify to ensure all variables are imported&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479359#M123714</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-07-19T02:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479361#M123716</link>
      <description>&lt;P&gt;Well, I cannot identify as its a huge file but SAS log says import unsuccessful , also I can see it says "invalid data for var5560 in line 278 32767-32767"&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479361#M123716</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-19T02:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479363#M123718</link>
      <description>&lt;P&gt;&amp;nbsp;I can see SAS log telling me "invalid data for var6677 in line 326 32767-32767" for various variables&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 03:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479363#M123718</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-19T03:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479367#M123720</link>
      <description>&lt;P&gt;This means that your CSV records are longer than 32767 bytes.&lt;/P&gt;
&lt;P&gt;How do you import the CSV data?&lt;/P&gt;
&lt;P&gt;You must lengthen LRECL.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 03:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479367#M123720</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T03:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479386#M123729</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried doing that but it isn't solving my problem. I can see that even though my original file contains data upto 4 digits but when I am importing it in SAS it is converting some values to large decimal places like below&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 473px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21855iAA8C55A68856E4A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess this is creating problem. Any idea how can I solve this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 05:41:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479386#M123729</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-19T05:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479390#M123731</link>
      <description>&lt;P&gt;Numerical precision is a whole different issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fix the record length issue first.&lt;/P&gt;
&lt;P&gt;Answer the question and show the code used and the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 05:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479390#M123731</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T05:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479394#M123733</link>
      <description>&lt;P&gt;I have been using the following code for fixing record length issue,&lt;/P&gt;&lt;PRE&gt;filename AR 'C:\Users\amalik\Desktop\dailydata\AR\DATEAR.XLSX' lrecl=27000;
proc import datafile=AR dbms=XLSX out=AR replace;
   run;&lt;/PRE&gt;&lt;P&gt;But it is still importing all variables as characters&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 06:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479394#M123733</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-19T06:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479396#M123735</link>
      <description>Is 27000 greater than 32767?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Jul 2018 06:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479396#M123735</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T06:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479397#M123736</link>
      <description>&lt;P&gt;Sorry, I did replace it with a value greater than 32767&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 07:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479397#M123736</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-19T07:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479409#M123741</link>
      <description>&lt;P&gt;DO NOT use proc import. It's guessing will only cause trouble.&lt;/P&gt;
&lt;P&gt;Inspect your csv file with a solid text editor like notepad++.&lt;/P&gt;
&lt;P&gt;It will show you the file type (DOS, UNIX or Mac), which then helps you in using the correct TERMSTR in the infile statement, which most probably will alleviate your lrecl problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have problems, post some lines of your csv as an attachment here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 07:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479409#M123741</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-19T07:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479542#M123817</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114858"&gt;@Amalik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;I can see SAS log telling me "invalid data for var6677 in line 326 32767-32767" for various variables&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Gads, you have at least 6677 variables, which is very questionable in the first place. The specific message is saying that AFTER proc import determined what type of data var6677 should be (after examining the first few rows of data) that the value encountered on line 326 did not match. Most likely is SAS guessed that the variable is numeric and encountered something in the cell that does not match the layout of previous cells such as special characters like ()*$, or previous values were treated as dates and the value in the cell was not recognizable as a valid date format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using Proc Import with csv add the option Guessingrows=max. This option will have SAS examine more rows before assigning variable types, informats and formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc import for csv will generate the data step code used to read the file. Look in the log above all of the invalid data messages. There you can see the informats assigned for reading the values. Though with over 6000 variables there is going to be a lot of lines of code since the procedure generated one informat and format statement for each variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If indeed ALL of your variables are numeric something similar to this should work:&lt;/P&gt;
&lt;PRE&gt;data want;
   infile "path and filename goes here.csv" dlm=',' lrecl=50000 truncover;
   informat var1-var7000 best32.; /*replace 7000 with the expected number of columns*/
   input var1-var7000;
run;&lt;/PRE&gt;
&lt;P&gt;though you may still have to increase the lrecl.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note there is also a possible issue with CSV created from Excel files of "phantom" columns. In csv you sometimes get rows that end with ,,,,,,,, (the number of , varies)&amp;nbsp;representing something in the history of the Excel file that no longer contains data due to deletion but Excel considers those columns "used" and will export them to csv.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 15:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/479542#M123817</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-19T15:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/480109#M124043</link>
      <description>&lt;P&gt;I was finally able to find out the issue in the file. Actually the excel and csv version of files both contain * in them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;The number is shown as a number say 1.12 but when I use ctrl+F and find *, it finds the numbered cell. When I replace * with a blank, it replaces the entire number say 1.12 will replace with a blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iam unsure on how to handle this weird issue. Any suggestions please?&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2018 01:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/480109#M124043</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-21T01:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: importing file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/480302#M124124</link>
      <description>&lt;P&gt;Do not use Excel.&lt;/P&gt;
&lt;P&gt;What value do you see when you open the CSV file with a text editor?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 23:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-file/m-p/480302#M124124</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-22T23:32:20Z</dc:date>
    </item>
  </channel>
</rss>

