<?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: reading xml file and formatting dates in some of the tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-xml-file-and-formatting-dates-in-some-of-the-tables/m-p/70804#M15308</link>
    <description>Hi Wendy,&lt;BR /&gt;
&lt;BR /&gt;
From that last SQL statement, do you think that by transposing the DATENAMES table you'd get a more useful result? &lt;BR /&gt;
&lt;BR /&gt;
Warm regards,&lt;BR /&gt;
Vasile</description>
    <pubDate>Wed, 09 Feb 2011 20:58:29 GMT</pubDate>
    <dc:creator>Vasile01</dc:creator>
    <dc:date>2011-02-09T20:58:29Z</dc:date>
    <item>
      <title>reading xml file and formatting dates in some of the tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-xml-file-and-formatting-dates-in-some-of-the-tables/m-p/70803#M15307</link>
      <description>I need some help!  I've been going around in the documentation for a couple of days and I'm stumped.  &lt;BR /&gt;
&lt;BR /&gt;
I'm trying to set up a program that will E-mail folks when equipment needs to be maintained, and all of the information I need is contained in an xml file, along with other project information.  &lt;BR /&gt;
&lt;BR /&gt;
I have been able to set up a macro that reads all the individual tables (15) out of the xml file and spits them out to an Excel workbook so I can look at them. &lt;BR /&gt;
&lt;BR /&gt;
LIBNAME EQUIP XML "\\inputpath\OurEquipmentData.xml"  ; &lt;BR /&gt;
&lt;BR /&gt;
PROC SQL NOPRINT ;&lt;BR /&gt;
SELECT MEMNAME INTO: TABLENAME SEPARATED BY ' '&lt;BR /&gt;
FROM SASHELP.VTABLE&lt;BR /&gt;
WHERE LIBNAME='EQUIP' ;&lt;BR /&gt;
QUIT; &lt;BR /&gt;
&lt;BR /&gt;
%MACRO READEQUIP ;&lt;BR /&gt;
&lt;BR /&gt;
%LET TABLECOUNT=%sysfunc(COUNTW(&amp;amp;TABLENAME)) ;&lt;BR /&gt;
%DO ZZ=1 %TO &amp;amp;TABLECOUNT ;&lt;BR /&gt;
%LET DSN=%SCAN(&amp;amp;TABLENAME,&amp;amp;ZZ) ;&lt;BR /&gt;
&lt;BR /&gt;
DATA &amp;amp;DSN  ; SET EQUIP.&amp;amp;DSN ; &lt;BR /&gt;
RUN ;&lt;BR /&gt;
&lt;BR /&gt;
PROC EXPORT DATA=WORK.&amp;amp;DSN OUTFILE="\\outputpath\EXCEL_EQUIPMENT_FILE.xlsx" DBMS=EXCEL REPLACE LABEL ; SHEET="&amp;amp;DSN" ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
&lt;BR /&gt;
%END ;&lt;BR /&gt;
%MEND ;&lt;BR /&gt;
&lt;BR /&gt;
%READEQUIP ;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
However, the datetime format in the xml file is a bit strange, and comes in as text.  The informat E8601DT. will do the translation to a SAS datetime.&lt;BR /&gt;
&lt;BR /&gt;
NEWDATE=INPUT(DATE,E8601DT.); &lt;BR /&gt;
FORMAT NEWDATE DATETIME23. ; &lt;BR /&gt;
 (or TEMPEXPDATE, as the case may be)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Here's where I'm stuck:  8 of the 15 tables have a datetime variable.  In one table, it is named TEMPEXPDATE, and it is DATE in the rest. I can get a listing of the tables that contain "DATE" as part of the variable name from SASHELP.VCOLUMN.&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL NOPRINT ;&lt;BR /&gt;
CREATE TABLE DATENAMES AS&lt;BR /&gt;
SELECT &lt;BR /&gt;
MEMNAME,&lt;BR /&gt;
NAME&lt;BR /&gt;
FROM SASHELP.VCOLUMN&lt;BR /&gt;
WHERE LIBNAME='EQUIP' AND NAME CONTAINS 'DATE' ;&lt;BR /&gt;
QUIT; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
But I'm not sure how to use that information.&lt;BR /&gt;
&lt;BR /&gt;
Your help would be very much appreciated!&lt;BR /&gt;
&lt;BR /&gt;
Wendy T.</description>
      <pubDate>Wed, 09 Feb 2011 20:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-xml-file-and-formatting-dates-in-some-of-the-tables/m-p/70803#M15307</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2011-02-09T20:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: reading xml file and formatting dates in some of the tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-xml-file-and-formatting-dates-in-some-of-the-tables/m-p/70804#M15308</link>
      <description>Hi Wendy,&lt;BR /&gt;
&lt;BR /&gt;
From that last SQL statement, do you think that by transposing the DATENAMES table you'd get a more useful result? &lt;BR /&gt;
&lt;BR /&gt;
Warm regards,&lt;BR /&gt;
Vasile</description>
      <pubDate>Wed, 09 Feb 2011 20:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-xml-file-and-formatting-dates-in-some-of-the-tables/m-p/70804#M15308</guid>
      <dc:creator>Vasile01</dc:creator>
      <dc:date>2011-02-09T20:58:29Z</dc:date>
    </item>
  </channel>
</rss>

