<?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: Converting XML to XLSX in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142449#M37894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the macro to display the macro variables passed in to see if that's the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm assuming this means you don't see the VBS code in the folder?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2015 17:48:00 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-01-28T17:48:00Z</dc:date>
    <item>
      <title>Converting XML to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142446#M37891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to convert xml files to xlsx in sas. This link shows how to do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/kb/43/496.html"&gt;http://support.sas.com/kb/43/496.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the code in the link and setting up the same folder names(i.e. c:\temp ...), the program works perfectly. However, when I change the directory it doesn't work. The log doesn't seem to display errors but a black box appears for a second after the program is run. Here is the code I am using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods noresults;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class out=test;&amp;nbsp; &lt;/P&gt;&lt;P&gt;by age; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file="S:\Matthew\SAS\XML to Excel\convert\temp.xml" newfile=bygroup;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=test;&amp;nbsp; &lt;/P&gt;&lt;P&gt;by age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxsync noxwait;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename convert 'S:\Matthew\SAS\XML to Excel\sasmacro' ; %include convert(convert.sas);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%convert_files(default=S:\Matthew\SAS\XML to Excel\convert,store=S:\Matthew\SAS\XML to Excel\temp.vbs,ext=xml);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the convert.sas macro is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro convert_files(default=S:\Matthew\SAS\XML to Excel\convert, store=S:\Matthew\SAS\XML to Excel\,ext=xml&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THE BELOW CODE IS IN THE LINK :-&lt;/P&gt;&lt;P&gt;data _null_; file "&amp;amp;store"; put " Dim oXL "; put " Dim oFolder"; put " Dim aFile"; put " Dim FSO"; put " Set oXL = CreateObject(""Excel.Application"")"; put " Set FSO = CreateObject(""Scripting.FileSystemObject"")"; put " oXL.DefaultFilePath = ""&amp;amp;default"""; put " oXL.DisplayAlerts = False"; put "&amp;nbsp; if FSO.FolderExists(oXL.DefaultFilePath) then"; put "&amp;nbsp;&amp;nbsp; Set oFolder = FSO.GetFolder(oXL.DefaultFilePath)"; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For each aFile in oFolder.Files "; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Right(LCase(aFile.Name), 4) = "".&amp;amp;ext"" Then"; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oXL.Workbooks.Open(aFile.Name)"; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oXL.Visible = false"; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (oXL.Version) &amp;gt;= 12 Then" ; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oXL.ActiveWorkBook.SaveAs Left(aFile, Len(aFile) - 4) &amp;amp; "".xlsx"",51"; put "&amp;nbsp;&amp;nbsp;&amp;nbsp; Else"; put "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oXL.ActiveWorkBook.SaveAs Left(aFile, Len(aFile) - 4) &amp;amp; "".xls"",-4143"; put "&amp;nbsp;&amp;nbsp; End If"; put " oXL.ActiveWorkBook.Close SaveChanges = True"; put " End If"; put " Next"; put " Set oFolder = Nothing"; put " end if"; put " FSO.DeleteFile(""&amp;amp;default\*.&amp;amp;ext""), DeleteReadOnly"; put " oXL.DisplayAlerts = True"; put " oXL.Quit"; put " Set oXL = Nothing"; call system("&amp;amp;store"); run; %mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 16:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142446#M37891</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-01-28T16:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142447#M37892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the VBS script being created in the folder? If you double click it does it run?&lt;/P&gt;&lt;P&gt;You may not be able to run VBS scripts at particular locations on your system due to security reasons.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142447#M37892</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T17:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142448#M37893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that's the problem since when I set up the folder S;\temp instead of S:\Matthew\SAS\XML to Excel\temp it doesn't work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could it be to do with the gaps in the folder location i.e. XML to Excel?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142448#M37893</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-01-28T17:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142449#M37894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the macro to display the macro variables passed in to see if that's the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm assuming this means you don't see the VBS code in the folder?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142449#M37894</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T17:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142450#M37895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You didn't specify the STORE macro variable properly, it is meant to be a reference to a VBS file that SAS will generate. &lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;brophymj wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Works:&lt;/P&gt;
&lt;P&gt;%convert_files(default=S:\Matthew\SAS\XML to Excel\convert,store=&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;S:\Matthew\SAS\XML to Excel\temp.vbs&lt;/STRONG&gt;&lt;/SPAN&gt;,ext=xml);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Doesn't work:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%macro convert_files(default=S:\Matthew\SAS\XML to Excel\convert, store=&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;S:\Matthew\SAS\XML to Excel\&lt;/STRONG&gt;&lt;/SPAN&gt;,ext=xml);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 18:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/142450#M37895</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T18:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/538582#M74035</link>
      <description>&lt;P&gt;Hello Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how and where to define the STORE variable in the macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 07:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-XML-to-XLSX/m-p/538582#M74035</guid>
      <dc:creator>pavan1</dc:creator>
      <dc:date>2019-02-26T07:55:53Z</dc:date>
    </item>
  </channel>
</rss>

