<?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: empty cells in Excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356876#M83739</link>
    <description>&lt;P&gt;We have seen this error before on CSV files.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Unable to sample external file, no data in first 5 records.
ERROR: Import unsuccessful. See SAS Log for details.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the past it was caused by someone using Macintosh version of Excel to create the CSV file. By default that version of Excel will create a text file that uses just a CR character ('0D'x) as the end of line. There should be other output types in Macintosh version of Excel that will let you create a file with normal end of line characters. &amp;nbsp;perhaps something like CSV for MS DOS .&lt;/P&gt;
&lt;P&gt;If you can't recreate it try using a FILENAME statement to let SAS know that CR is the end of line character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myfile "/folders/myfolders/2016/SALUDA/EFFORT.csv" termstr=cr;

PROC IMPORT DATAFILE=myfile 
  OUT=WORK.EFFORT REPLACE
  DBMS=CSV
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2017 14:12:49 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-05-08T14:12:49Z</dc:date>
    <item>
      <title>empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356649#M83633</link>
      <description>&lt;P&gt;I have an excel file with several empty cells. I am trying to use Proc Means on one of the variables with the empty cells but I keep getting an error that says "variable does not match the type prescribed for this list"...How do I deal with empty cells? I have tried leaving them blank and putting a . in the cell but neither has worked. &amp;nbsp;Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 06 May 2017 20:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356649#M83633</guid>
      <dc:creator>vicdicenzo</dc:creator>
      <dc:date>2017-05-06T20:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356653#M83636</link>
      <description>&lt;P&gt;I think the problem has to do with the otherwise numeric cells, in Excel, containing blanks. As such, SAS will convert the variable to be a character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can use the Excel engine, you can force such variables to be numeric and automatically convert the blank cells to missing values. e.g.:&lt;/P&gt;
&lt;PRE&gt;proc import datafile="/folders/myfolders/class.xlsx" out=want dbms=excel replace;
  DBDSOPTS= "DBTYPE=(age='NUM(8)'";
  sheet='Sheet1'&lt;BR /&gt;run;
&lt;/PRE&gt;
&lt;P&gt;Otherwise, you'd have to create a new, numeric variable by input(ting) the character variable. e.g.:&lt;/P&gt;
&lt;PRE&gt;data want (drop=_:);
  set have (rename=(age=_age));
  age=input(_age,?? 8.);
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 May 2017 21:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356653#M83636</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-06T21:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356690#M83656</link>
      <description>&lt;P&gt;The only real solution to this kind of problems is to use a sensible, reliable file format for the data transfer; this allows you to use a well-defined process (data step) where you have control over how the data is imported. Both proc import and libname excel have to guess what is where, and that is sub-optimal to say the least.&lt;/P&gt;
&lt;P&gt;So save from Excel as csv, use proc import once for getting a data step, extract that from the log and adapt it to your needs.&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2017 07:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356690#M83656</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-07T07:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356832#M83730</link>
      <description>&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the tips. &amp;nbsp;I tried the first suggestion and received an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;/** Import an XLSX file. **/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 PROC IMPORT DATAFILE="/folders/myfolders/2016/SALUDA/EFFORT.XLSX"&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 OUT=WORK.EFFORT&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 DBMS=XLSX&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 REPLACE;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;NOTE: The previous statement has been deleted.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;83 DBDSOPTS= "DBTYPE=(age='NUM(8)'";&lt;/DIV&gt;&lt;DIV class="sasError"&gt;________&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;84 sheet='Sheet1';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;85 RUN;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Seems like the DBDSOPTS is incorrect?&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 May 2017 11:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356832#M83730</guid>
      <dc:creator>vicdicenzo</dc:creator>
      <dc:date>2017-05-08T11:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356834#M83732</link>
      <description>&lt;P&gt;OK thanks. What is the DBMS= code? I tried Proc Import of a csv file and it did not work. &amp;nbsp;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;/** Import an XLSX file. **/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 PROC IMPORT DATAFILE="/folders/myfolders/2016/SALUDA/EFFORT.csv"&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 OUT=WORK.EFFORT&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 DBMS=CSV&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 REPLACE;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;83&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;84 RUN;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;parameter values will be saved to WORK.PARMS.PARMS.SLIST.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Unable to sample external file, no data in first 5 records.&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;ERROR: Import unsuccessful. See SAS Log for details.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 May 2017 11:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356834#M83732</guid>
      <dc:creator>vicdicenzo</dc:creator>
      <dc:date>2017-05-08T11:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356864#M83736</link>
      <description>&lt;P&gt;The first suggestion was to use the EXCEL (not XLSX) engine .. if you can. It does allow one to use the DBDSOPTS option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 13:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356864#M83736</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-08T13:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: empty cells in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356876#M83739</link>
      <description>&lt;P&gt;We have seen this error before on CSV files.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Unable to sample external file, no data in first 5 records.
ERROR: Import unsuccessful. See SAS Log for details.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the past it was caused by someone using Macintosh version of Excel to create the CSV file. By default that version of Excel will create a text file that uses just a CR character ('0D'x) as the end of line. There should be other output types in Macintosh version of Excel that will let you create a file with normal end of line characters. &amp;nbsp;perhaps something like CSV for MS DOS .&lt;/P&gt;
&lt;P&gt;If you can't recreate it try using a FILENAME statement to let SAS know that CR is the end of line character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myfile "/folders/myfolders/2016/SALUDA/EFFORT.csv" termstr=cr;

PROC IMPORT DATAFILE=myfile 
  OUT=WORK.EFFORT REPLACE
  DBMS=CSV
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 14:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/empty-cells-in-Excel/m-p/356876#M83739</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-08T14:12:49Z</dc:date>
    </item>
  </channel>
</rss>

