<?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: SAS/ACCESS 9.4: SQL Pass Through Facility for EXCEL - MIXED Option in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-9-4-SQL-Pass-Through-Facility-for-EXCEL-MIXED-Option/m-p/430657#M106457</link>
    <description>&lt;P&gt;I don't know of a way using pass through, otherwise, look into DBSASTYPE option.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2018 20:15:03 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-01-24T20:15:03Z</dc:date>
    <item>
      <title>SAS/ACCESS 9.4: SQL Pass Through Facility for EXCEL - MIXED Option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-9-4-SQL-Pass-Through-Facility-for-EXCEL-MIXED-Option/m-p/430646#M106451</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am currently using the PROC SQL Pass Through Facility to import an EXCEL file. Now the &lt;STRONG&gt;import and code is working&lt;/STRONG&gt; but it seems one variable is being imported as the wrong type. I have tried the MIXED option yet this does not seem to be working. As a bit of background below are some&amp;nbsp;context&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;SAS Pass Through Facility&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n12a4kxu1n231qn175rljheioy8a.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;http://documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n12a4kxu1n231qn175rljheioy8a.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;MIXED=YES Details&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When reading data from Excel, SAS scans a column to determine if it is numeric or character, and if character, determine the width. Normally if an initially numeric column has subsequent character data, SAS will make the variable numeric and set the character values to missing. The “MIXED=YES” libname connection option tells SAS to convert such columns to character, thus saving the character entries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Problem&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When importing the EXCEL sheet one column is automatically becoming numeric, assuming due to SAS reading the first few rows and making the determination the column is all numeric when later down the EXCEL sheet there are character values in the column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is an example of the EXCEL Sheet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;VAR1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VAR2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;Some&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;BR /&gt;Text&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;45&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;/SPAN&gt;&lt;BR /&gt;Variable&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 55&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/SPAN&gt;&lt;BR /&gt;With&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/SPAN&gt;&lt;BR /&gt;Just&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DATETIME20.&amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;BR /&gt;Character&amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;44&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;/SPAN&gt;&lt;BR /&gt;Values&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DATE9.&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Code I use to import the EXCEL sheet&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    connect to excel (path = "mypath\myfile.xls" mixed=YES);
        create table mydataset as
        select *
        from connection to excel (select * from [myexceltabname$A2:S]);
    disconnect from excel;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Output&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The EXCEL sheet imports but the variable &lt;STRONG&gt;VAR2&amp;nbsp;&lt;/STRONG&gt;is made a numeric variable and all character values are now null. Is there an option I can use to correct this, the MIXED option did not seem to do anything. Any help would be grateful, I should note Ideally I want to use the Pass Through Facility if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 20:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-9-4-SQL-Pass-Through-Facility-for-EXCEL-MIXED-Option/m-p/430646#M106451</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2018-01-24T20:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/ACCESS 9.4: SQL Pass Through Facility for EXCEL - MIXED Option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-9-4-SQL-Pass-Through-Facility-for-EXCEL-MIXED-Option/m-p/430657#M106457</link>
      <description>&lt;P&gt;I don't know of a way using pass through, otherwise, look into DBSASTYPE option.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 20:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-9-4-SQL-Pass-Through-Facility-for-EXCEL-MIXED-Option/m-p/430657#M106457</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-24T20:15:03Z</dc:date>
    </item>
  </channel>
</rss>

