<?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: Need to read several date columns from excel file into SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920020#M362364</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20562"&gt;@SAS_1001&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;As advised by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;try changing the DBMS to xlsx.&lt;BR /&gt;I tried your code after changing DBMS=XLSX and everything is as you wanted.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1710276233912.png" style="width: 634px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94594i3BC4AC03E61BED96/image-dimensions/634x65?v=v2" width="634" height="65" role="button" title="Sajid01_0-1710276233912.png" alt="Sajid01_0-1710276233912.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2024 20:44:20 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2024-03-12T20:44:20Z</dc:date>
    <item>
      <title>Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/919983#M362345</link>
      <description>&lt;P&gt;Trying to read several date columns (100+) from excel file into SAS. Dates are coming as a number but the idea is to read them exactly as they reflect below in the SAS Dataset.&amp;nbsp; The platform is: SAS Studio on Linux Platform.&amp;nbsp; Any help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="1323"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="63"&gt;1/5/2022&lt;/TD&gt;
&lt;TD width="71"&gt;1/12/2022&lt;/TD&gt;
&lt;TD width="71"&gt;1/19/2022&lt;/TD&gt;
&lt;TD width="71"&gt;1/26/2022&lt;/TD&gt;
&lt;TD width="36"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63"&gt;2/2/2022&lt;/TD&gt;
&lt;TD width="63"&gt;2/9/2022&lt;/TD&gt;
&lt;TD width="71"&gt;2/16/2022&lt;/TD&gt;
&lt;TD width="71"&gt;2/23/2022&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63"&gt;3/2/2022&lt;/TD&gt;
&lt;TD width="63"&gt;3/9/2022&lt;/TD&gt;
&lt;TD width="71"&gt;3/16/2022&lt;/TD&gt;
&lt;TD width="71"&gt;3/23/2022&lt;/TD&gt;
&lt;TD width="71"&gt;3/30/2022&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63"&gt;4/6/2022&lt;/TD&gt;
&lt;TD width="71"&gt;4/13/2022&lt;/TD&gt;
&lt;TD width="71"&gt;4/20/2022&lt;/TD&gt;
&lt;TD width="71"&gt;4/27/2022&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 12 Mar 2024 18:26:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/919983#M362345</guid>
      <dc:creator>SAS_1001</dc:creator>
      <dc:date>2024-03-12T18:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/919989#M362349</link>
      <description>&lt;P&gt;What exactly do you mean by "read them exactly as they reflect below"?&lt;/P&gt;
&lt;P&gt;Are those values in Excel strings or dates with the mm/dd/yyyy cell appearance added as a property?&lt;/P&gt;
&lt;P&gt;What values are you getting in SAS that you don't like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FWIW, dates in SAS are numbers whose appearance for humans to think they represent a date are controlled by a format. Change the format and the appearance changes but the underlying number doesn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If SAS is displaying values in a manner you don't like you can create custom formats that will show just about any typical date appearance (and few some consider odd like Julian dates).&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 18:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/919989#M362349</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-12T18:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920008#M362358</link>
      <description>&lt;P&gt;Columns should be read as dates and populate them exactly as they are but not get translated into numbers.&amp;nbsp; The options that I use in PC SAS with the below syntax works:&lt;/P&gt;
&lt;P&gt;PROC IMPORT OUT= WORK.zz &lt;BR /&gt;DATAFILE= "Y:\folder1\sdm\customs2.xlsx" &lt;BR /&gt;DBMS=EXCEL REPLACE;&lt;BR /&gt;RANGE="'Scheduling Table$'"; &lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;MIXED=NO;&lt;BR /&gt;SCANTEXT=YES;&lt;BR /&gt;USEDATE=YES;&lt;BR /&gt;SCANTIME=YES;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I ran the same syntax in SAS Studio in Linux, it's not working with the following error:&lt;/P&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;69 PROC IMPORT OUT= WORK.zz&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;70 DATAFILE= "&lt;SPAN&gt;/home/mnt/dts-04.xls&lt;/SPAN&gt;"&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;71 DBMS=EXCEL REPLACE;&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1710273564238" class="sasError"&gt;ERROR: DBMS type EXCEL not valid for import.&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1710273564238" class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Mar 2024 20:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920008#M362358</guid>
      <dc:creator>SAS_1001</dc:creator>
      <dc:date>2024-03-12T20:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920010#M362359</link>
      <description>&lt;P&gt;Old Excel files (.xls) can only be read on Windows or (from any platform) by using the (also Windows-only) PC Files Server.&lt;/P&gt;
&lt;P&gt;On UNIX, you need the newer .xlsx files, which can be read with DBMS=XLSX.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 20:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920010#M362359</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-12T20:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920020#M362364</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20562"&gt;@SAS_1001&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;As advised by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;try changing the DBMS to xlsx.&lt;BR /&gt;I tried your code after changing DBMS=XLSX and everything is as you wanted.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1710276233912.png" style="width: 634px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94594i3BC4AC03E61BED96/image-dimensions/634x65?v=v2" width="634" height="65" role="button" title="Sajid01_0-1710276233912.png" alt="Sajid01_0-1710276233912.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 20:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920020#M362364</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2024-03-12T20:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920024#M362365</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20562"&gt;@SAS_1001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Trying to read several date columns (100+) from excel file into SAS. Dates are coming as a number but the idea is to read them exactly as they reflect below in the SAS Dataset.&amp;nbsp; The platform is: SAS Studio on Linux Platform.&amp;nbsp; Any help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="1323"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="63"&gt;1/5/2022&lt;/TD&gt;
&lt;TD width="71"&gt;1/12/2022&lt;/TD&gt;
&lt;TD width="71"&gt;1/19/2022&lt;/TD&gt;
&lt;TD width="71"&gt;1/26/2022&lt;/TD&gt;
&lt;TD width="36"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63"&gt;2/2/2022&lt;/TD&gt;
&lt;TD width="63"&gt;2/9/2022&lt;/TD&gt;
&lt;TD width="71"&gt;2/16/2022&lt;/TD&gt;
&lt;TD width="71"&gt;2/23/2022&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63"&gt;3/2/2022&lt;/TD&gt;
&lt;TD width="63"&gt;3/9/2022&lt;/TD&gt;
&lt;TD width="71"&gt;3/16/2022&lt;/TD&gt;
&lt;TD width="71"&gt;3/23/2022&lt;/TD&gt;
&lt;TD width="71"&gt;3/30/2022&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63"&gt;4/6/2022&lt;/TD&gt;
&lt;TD width="71"&gt;4/13/2022&lt;/TD&gt;
&lt;TD width="71"&gt;4/20/2022&lt;/TD&gt;
&lt;TD width="71"&gt;4/27/2022&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Dates ARE numbers.&lt;/P&gt;
&lt;P&gt;Please explain in more detail what is not working?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if the COLUMN in the WORKSHEET has mixed numeric and character CELLS then the VARIABLE in the resulting SAS dataset will have to be CHARACTER (you can represent a number as a string of digits but you cannot represent a string of letters as a number).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case SAS will store the digit string that represents the number that EXCEL uses to represent that date.&amp;nbsp; You can convert it to a SAS date value by first converting it back into a number and then adjusting the value for the difference in how the two systems start counting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you end up with a dataset named HAVE with a character variable named CHARSTRING you can use a step like this to make a dataset named WANT that adds a numeric variable named DATE that has date values.&amp;nbsp; Then attach whatever format you want so that the date value prints in a way that is easy for humans to read.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  date = input(charstring,32.) + '30DEC1988'd;
  format date date9.
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2024 21:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920024#M362365</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T21:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920031#M362368</link>
      <description>&lt;P&gt;well, it's working in PC SAS but in SAS Studio its giving numbers.&amp;nbsp; Tried other solutions as well but no luck yet.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 21:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920031#M362368</guid>
      <dc:creator>SAS_1001</dc:creator>
      <dc:date>2024-03-12T21:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920033#M362369</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20562"&gt;@SAS_1001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;well, it's working in PC SAS but in SAS Studio its giving numbers.&amp;nbsp; Tried other solutions as well but no luck yet.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well PC-SAS is running on a PC.&amp;nbsp; So it is possible for the EXCEL engine, which calls code installed by EXCEL, to work.&amp;nbsp; But it sounds like your SAS/Studio session is connected to a copy of SAS that is not running on Windows.&amp;nbsp; In that case you need to use the XLSX engine.&amp;nbsp; (or in the case of your second code block the XLS engine)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I would be surprised if it really treated a column with mixed DATE and CHARACTER cells any differently with the XLSX engine than it does with the EXCEL engine.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 22:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920033#M362369</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-12T22:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need to read several date columns from excel file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920116#M362398</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20562"&gt;@SAS_1001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;well, it's working in PC SAS but in SAS Studio its giving numbers.&amp;nbsp; Tried other solutions as well but no luck yet."&lt;BR /&gt;I tested the code in SAS Studio itself - SAS on Demand for Academics and posted the results.&lt;BR /&gt;I repeat what you need to do&amp;nbsp; - use dbms=XLSX .&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 13:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-read-several-date-columns-from-excel-file-into-SAS/m-p/920116#M362398</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2024-03-13T13:21:29Z</dc:date>
    </item>
  </channel>
</rss>

