<?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: Could not able to read data correctly. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348412#M80668</link>
    <description>&lt;P&gt;The '*' means that the actual value cannot be displayed in 1 character. Remove the format from the variable if you want to see the values that were actually imported.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set have ;
  if eligible ne 0 then put eligible = best32. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also try using the XLSX (or XLS) engine on a LIBNAME instead of using PROC IMPORT and see if the values are converted differently.&lt;/P&gt;</description>
    <pubDate>Sat, 08 Apr 2017 13:25:30 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-04-08T13:25:30Z</dc:date>
    <item>
      <title>Could not able to read data correctly.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348388#M80657</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a excel file which has many sheet.&lt;/P&gt;&lt;P&gt;Have imported data with proc import mentioning sheet as "day" and dbms as "excel".&lt;/P&gt;&lt;P&gt;I have sucessfylly imported data in SAS but there exist a problem with one of my variable that is "ELIGIBLE"&lt;/P&gt;&lt;P&gt;The variable "ELIGIBLE" ahs two values TRUE and FALSE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while importing SAS shows 0 and * as value.&lt;/P&gt;&lt;P&gt;while cheking the column properties&amp;nbsp;its showing Type as Numeric , Lenght as 8 , format and informat as 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while checking the logs for proc import it also doesnot have the procedure import step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;&lt;P&gt;Vishyy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2017 09:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348388#M80657</guid>
      <dc:creator>vishyy</dc:creator>
      <dc:date>2017-04-08T09:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Could not able to read data correctly.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348396#M80660</link>
      <description>&lt;P&gt;Even though some people don't like Excel attachments for security reasons, I believe this is a case where you should provide your Excel with a few rows in it as well as your Proc Import code.&lt;/P&gt;
&lt;P&gt;What's happening here depends very much on how this "boolean" fields are defined in Excel.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2017 10:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348396#M80660</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-04-08T10:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Could not able to read data correctly.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348406#M80664</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Could not able to read data correctly.

This type of issue is best solved on the excel side using passthru.

inspired by
https://goo.gl/T7D0Nc
https://communities.sas.com/t5/Base-SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348388


HAVE
====

d:/xls/trufls.xlsx

 +------+-----------+
 |      |    A      |
 +------+-----------+
 |      |           |
 |    1 |  ELIGIBLE |
 |    2 |   TRUE    |
 |    3 |   FALSE   |
 |    4 |   TRUE    |
 |    5 |   FALSE   |
 |    6 |   TRUE    |
 | ...  |   ...     |
 +------------------+

 [SHEET1]

WANT  (SAS dataset DAY)
=======================

 Up to 40 obs WORK.DAY total obs=5

 Obs    ELIGIBLE

  1        1
  2        0
  3        1
  4        0
  5        1

WORKING CODE
===========

      select * from connection to Excel
      iif(eligible="TRUE",1,'0') as eligible

FULL SOLUTION
=============

*                _                  _       _
 _ __ ___   __ _| | _____        __| | __ _| |_ __ _
| '_ ` _ \ / _` | |/ / _ \_____ / _` |/ _` | __/ _` |
| | | | | | (_| |   &amp;lt;  __/_____| (_| | (_| | || (_| |
|_| |_| |_|\__,_|_|\_\___|      \__,_|\__,_|\__\__,_|

;

%utlfkil(d:/xls/trufls.xlsx);
libname xel "d:/xls/trufls.xlsx";
data xel.day;
  do eligible='TRUE ' ,'FALSE' ,'TRUE' ,'FALSE' ,'TRUE';
     output;
  end;
run;quit;
libname xel clear;

*          _       _   _
 ___  ___ | |_   _| |_(_) ___  _ __
/ __|/ _ \| | | | | __| |/ _ \| '_ \
\__ \ (_) | | |_| | |_| | (_) | | | |
|___/\___/|_|\__,_|\__|_|\___/|_| |_|

;

/* [day$] if not named range */

proc sql dquote=ansi;
  connect to excel (Path="d:\xls\trufls.xlsx" mixed=yes);
    create
        table day as
    select * from connection to Excel
        (
         Select
            iif(eligible="TRUE",1,'0') as eligible
         from
           [day$]
        );
    disconnect from Excel;
Quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Apr 2017 12:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348406#M80664</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-04-08T12:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Could not able to read data correctly.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348407#M80665</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Could not able to read data correctly.

This type of issue is best solved on the excel side using passthru.

inspired by
https://goo.gl/T7D0Nc
https://communities.sas.com/t5/Base-SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348388


HAVE
====

d:/xls/trufls.xlsx

 +------+-----------+
 |      |    A      |
 +------+-----------+
 |      |           |
 |    1 |  ELIGIBLE |
 |    2 |   TRUE    |
 |    3 |   FALSE   |
 |    4 |   TRUE    |
 |    5 |   FALSE   |
 |    6 |   TRUE    |
 | ...  |   ...     |
 +------------------+

 [SHEET1]

WANT  (SAS dataset DAY)
=======================

 Up to 40 obs WORK.DAY total obs=5

 Obs    ELIGIBLE

  1        1
  2        0
  3        1
  4        0
  5        1

WORKING CODE
===========

      select * from connection to Excel
      iif(eligible="TRUE",1,'0') as eligible

FULL SOLUTION
=============

*                _                  _       _
 _ __ ___   __ _| | _____        __| | __ _| |_ __ _
| '_ ` _ \ / _` | |/ / _ \_____ / _` |/ _` | __/ _` |
| | | | | | (_| |   &amp;lt;  __/_____| (_| | (_| | || (_| |
|_| |_| |_|\__,_|_|\_\___|      \__,_|\__,_|\__\__,_|

;

%utlfkil(d:/xls/trufls.xlsx);
libname xel "d:/xls/trufls.xlsx";
data xel.day;
  do eligible='TRUE ' ,'FALSE' ,'TRUE' ,'FALSE' ,'TRUE';
     output;
  end;
run;quit;
libname xel clear;

*          _       _   _
 ___  ___ | |_   _| |_(_) ___  _ __
/ __|/ _ \| | | | | __| |/ _ \| '_ \
\__ \ (_) | | |_| | |_| | (_) | | | |
|___/\___/|_|\__,_|\__|_|\___/|_| |_|

;

/* [day$] if not named range */

proc sql dquote=ansi;
  connect to excel (Path="d:\xls\trufls.xlsx" mixed=yes);
    create
        table day as
    select * from connection to Excel
        (
         Select
            iif(eligible="TRUE",1,'0') as eligible
         from
           [day$]
        );
    disconnect from Excel;
Quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2017 12:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348407#M80665</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-04-08T12:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Could not able to read data correctly.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348412#M80668</link>
      <description>&lt;P&gt;The '*' means that the actual value cannot be displayed in 1 character. Remove the format from the variable if you want to see the values that were actually imported.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set have ;
  if eligible ne 0 then put eligible = best32. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also try using the XLSX (or XLS) engine on a LIBNAME instead of using PROC IMPORT and see if the values are converted differently.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2017 13:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Could-not-able-to-read-data-correctly/m-p/348412#M80668</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-08T13:25:30Z</dc:date>
    </item>
  </channel>
</rss>

