<?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: PROC IMPORT XLSX File and Specify Formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914356#M360291</link>
    <description>&lt;P&gt;If you want to control an INFORMAT (not form when reading data) then save the XLSX to CSV and write a data step to use the informat that you want. Assign a display format that your like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I strongly suggest instead of showing pictures, where we have absolutely no idea what actual values you have, that at least provide the output from Contents to describe the SAS data set created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a datetime value and display it with a DATETIME9. format it will look like that. So it may have been read as desired but the format to display it is just not wide enough.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2024 22:28:33 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-02-02T22:28:33Z</dc:date>
    <item>
      <title>PROC IMPORT XLSX File and Specify Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914349#M360287</link>
      <description>&lt;P&gt;I am trying to import an xslx data file.&amp;nbsp; There are several fields that have date/time values, but when SAS imports, they are converted to just the date value.&amp;nbsp; There are no blank values or other data in the columns that would encourage SAS to make up a different format.&amp;nbsp; I cannot figure out how to force it to read the full date and time.&amp;nbsp; I have played around with&amp;nbsp;&lt;SPAN&gt;DBDSOPTS, but I don't think I fully understand how that works.&amp;nbsp; My log is coming out clean.&amp;nbsp; I have attached a sample file for you to play with.&amp;nbsp; Can someone help?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Data in Excel:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="djbateman_1-1706911547033.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93252i99364555B839F11D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="djbateman_1-1706911547033.png" alt="djbateman_1-1706911547033.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Data in SAS after import:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="djbateman_0-1706911524337.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93251i032F623034607B00/image-size/medium?v=v2&amp;amp;px=400" role="button" title="djbateman_0-1706911524337.png" alt="djbateman_0-1706911524337.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the code I am attempting to use:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename testrpt "C:\Test Report.xlsx";
proc import out=have datafile=testrpt dbms=excelcs replace;
     range="Export$";
     scantext=yes;
     usedate=yes;
     scantime=yes;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 22:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914349#M360287</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2024-02-02T22:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT XLSX File and Specify Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914354#M360290</link>
      <description>&lt;P&gt;Is the file accessible on the machine were SAS is running so that you can test what happens if you use XLSX as the DBMS setting instead of EXCELCS?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import dbms=xlsx file='c:\downloads\Test Report.xlsx' out=test replace ;
run;

proc contents varnum;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1706912093017.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93253i426CDACC756A9137/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1706912093017.png" alt="Tom_0-1706912093017.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 22:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914354#M360290</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-02T22:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT XLSX File and Specify Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914356#M360291</link>
      <description>&lt;P&gt;If you want to control an INFORMAT (not form when reading data) then save the XLSX to CSV and write a data step to use the informat that you want. Assign a display format that your like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I strongly suggest instead of showing pictures, where we have absolutely no idea what actual values you have, that at least provide the output from Contents to describe the SAS data set created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a datetime value and display it with a DATETIME9. format it will look like that. So it may have been read as desired but the format to display it is just not wide enough.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 22:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914356#M360291</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-02-02T22:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT XLSX File and Specify Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914361#M360292</link>
      <description>&lt;P&gt;I considered converting to CSV, but I will have to run this daily from updated files, and I need to be able to read in the data as it comes in rather than saving as csv every single day.&amp;nbsp; Just not sustainable.&amp;nbsp; But I will be sure to share the dataset contents next time.&amp;nbsp; I knew the imported dates were saved as DATE9., but didn't think to share that beyond my code and source file.&amp;nbsp; Thanks or the feedback.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 23:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914361#M360292</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2024-02-02T23:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT XLSX File and Specify Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914362#M360293</link>
      <description>This worked wonderfully!  I tried playing around with different DBMS sources, but I don't think I had the right syntax.  Thanks for your help.</description>
      <pubDate>Fri, 02 Feb 2024 23:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-XLSX-File-and-Specify-Formats/m-p/914362#M360293</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2024-02-02T23:07:17Z</dc:date>
    </item>
  </channel>
</rss>

