<?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: Execute Excel VBA Macro using SAS in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372623#M2079</link>
    <description>&lt;P&gt;You can launch Excel from SAS using the X command (or SYSTASK) and a VB Script program. &amp;nbsp;However, this works only when SAS and Excel are on the same machine, and of course, that machine has to be running Windows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are in the (very common) situation where SAS is running on a remote machine (on a server, and perhaps using Linux), then you can't run those X command steps directly. &amp;nbsp;Instead, you would need to copy the Excel file from the SAS server to a Windows machine, and then run the VB Script from there. &amp;nbsp;If you're using SAS Enterprise Guide for all of this, you can actually automate these steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Run a SAS program to generate the Excel file&lt;/LI&gt;
&lt;LI&gt;Use the Data-&amp;gt;Copy Files task to copy the Excel file to the local Windows machine&lt;/LI&gt;
&lt;LI&gt;Use the System Command task (a custom task you can download) to launch the VB Script&lt;/LI&gt;
&lt;LI&gt;If desired, use the Copy Files task again to upload the final Excel file back to the SAS server&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;For a very specific example of using SAS and Excel together for Pivot Tables, &lt;A href="http://blogs.sas.com/content/sgf/2015/03/27/using-sas-to-add-pivottables-to-your-excel-workbook/" target="_self"&gt;see this blog post&lt;/A&gt; from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13736"&gt;@Chevell_sas&lt;/a&gt;.&lt;/P&gt;</description>
    <pubDate>Sun, 02 Jul 2017 20:07:57 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2017-07-02T20:07:57Z</dc:date>
    <item>
      <title>Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372518#M2072</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone please help me with SAS code that would help execute Excel VBA Macro in SAS platform such that the whole process&amp;nbsp;is automated&amp;nbsp;?&lt;/P&gt;&lt;P&gt;I know how to open and run an Excel file in SAS&amp;nbsp;, but I don't know how to implement a VBA code in my SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS data that is exported in Excel is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;TD&gt;Gender&lt;/TD&gt;&lt;TD&gt;School&lt;/TD&gt;&lt;TD&gt;DOB&lt;/TD&gt;&lt;TD&gt;DOJ&lt;/TD&gt;&lt;TD&gt;Qualification&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;q&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;TD&gt;qq&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;TD&gt;aa&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;T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;&lt;TD&gt;f&lt;/TD&gt;&lt;TD&gt;ww&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;q&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;f&lt;/TD&gt;&lt;TD&gt;ww&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;f&lt;/TD&gt;&lt;TD&gt;uu&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;e&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;f&lt;/TD&gt;&lt;TD&gt;uu&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to implement the following Excel VBA code in SAS :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sub parse_data()&lt;BR /&gt;Dim lr As Long&lt;BR /&gt;Dim ws As Worksheet&lt;BR /&gt;Dim vcol, i As Integer&lt;BR /&gt;Dim icol As Long&lt;BR /&gt;Dim myarr As Variant&lt;BR /&gt;Dim title As String&lt;BR /&gt;Dim titlerow As Integer&lt;BR /&gt;vcol = 1&lt;BR /&gt;Set ws = Sheets("Sheet1")&lt;BR /&gt;lr = ws.Cells(ws.Rows.Count, vcol).End(xlUp).Row&lt;BR /&gt;title = "A1:C1"&lt;BR /&gt;titlerow = ws.Range(title).Cells(1).Row&lt;BR /&gt;icol = ws.Columns.Count&lt;BR /&gt;ws.Cells(1, icol) = "Unique"&lt;BR /&gt;For i = 2 To lr&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;If ws.Cells(i, vcol) &amp;lt;&amp;gt; "" And Application.WorksheetFunction.Match(ws.Cells(i, vcol), ws.Columns(icol), 0) = 0 Then&lt;BR /&gt;ws.Cells(ws.Rows.Count, icol).End(xlUp).Offset(1) = ws.Cells(i, vcol)&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;myarr = Application.WorksheetFunction.Transpose(ws.Columns(icol).SpecialCells(xlCellTypeConstants))&lt;BR /&gt;ws.Columns(icol).Clear&lt;BR /&gt;For i = 2 To UBound(myarr)&lt;BR /&gt;ws.Range(title).AutoFilter field:=vcol, Criteria1:=myarr(i) &amp;amp; ""&lt;BR /&gt;If Not Evaluate("=ISREF('" &amp;amp; myarr(i) &amp;amp; "'!A1)") Then&lt;BR /&gt;Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = myarr(i) &amp;amp; ""&lt;BR /&gt;Else&lt;BR /&gt;Sheets(myarr(i) &amp;amp; "").Move after:=Worksheets(Worksheets.Count)&lt;BR /&gt;End If&lt;BR /&gt;ws.Range("A" &amp;amp; titlerow &amp;amp; ":A" &amp;amp; lr).EntireRow.Copy Sheets(myarr(i) &amp;amp; "").Range("A1")&lt;BR /&gt;Sheets(myarr(i) &amp;amp; "").Columns.AutoFit&lt;BR /&gt;Next&lt;BR /&gt;ws.AutoFilterMode = False&lt;BR /&gt;ws.Activate&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 09:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372518#M2072</guid>
      <dc:creator>Skb19121985</dc:creator>
      <dc:date>2017-07-02T09:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372532#M2073</link>
      <description>&lt;P&gt;You can find a couple of examples of using SAS to run VB script in the paper at:&amp;nbsp;&lt;A href="http://www.sascommunity.org/wiki/A_Poor/Rich_SAS_Users_Proc_Export" target="_blank"&gt;http://www.sascommunity.org/wiki/A_Poor/Rich_SAS_Users_Proc_Export&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 12:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372532#M2073</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-02T12:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372540#M2074</link>
      <description>&lt;P&gt;If you have a SAS process that generates this sheet, maybe you can add a simpler SAS step to create the additional sheets you're looking for. &amp;nbsp;I didn't carefully read the VBA you've got, but it seems that you're creating some crosstab sheets to summarize the first sheet. &amp;nbsp;You could probably acheive with PROC TABULATE, PROC SQL, or PROC REPORT -- and then use ODS Excel to export a workbook with the original data and then the summarized data on subsequent sheets. &amp;nbsp;Fewer moving parts if you don't have to automate Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you post an example of the subsquent sheets that you want, we could provide a more specific recommendation.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 13:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372540#M2074</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-07-02T13:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372559#M2075</link>
      <description>&lt;P&gt;Another approach to this situation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a template with the macro and or cross tabs you want using pivot tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add a macro or select the option that forces the tables to refresh when file is opened&lt;/P&gt;
&lt;P&gt;For each update, copy template, refresh data source, tables are updated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 15:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372559#M2075</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-02T15:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372570#M2076</link>
      <description>&lt;P&gt;Hi Chris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&lt;/P&gt;&lt;P&gt;Actually, I have just cited an example of Excel VBA Macro. In general, it can be any Excel VBA Macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just wanted to know the process through which I could execute any Excel VBA Macro using SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 16:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372570#M2076</guid>
      <dc:creator>Skb19121985</dc:creator>
      <dc:date>2017-07-02T16:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372572#M2077</link>
      <description>&lt;P&gt;Hi Reeza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestions. It is in my mind.&lt;/P&gt;&lt;P&gt;There are different ways to automate the process.&lt;/P&gt;&lt;P&gt;I wanted to automate SAS and Excel together, to an extent that the only platform I work with would be SAS but I at the same time I take control of Excel using Excel VBA Macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Excel VBA code , I cited in my query was just an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, I wanted to execute any Excel VBA Macro using SAS and get desired result in Excel. Ab initio, it is to be understood that no matter whatever be the Excel VBA Macro,&amp;nbsp;it is&amp;nbsp;tested to run error free in Excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 16:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372572#M2077</guid>
      <dc:creator>Skb19121985</dc:creator>
      <dc:date>2017-07-02T16:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372575#M2078</link>
      <description>&lt;P&gt;Hi Sir&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this !&lt;/P&gt;&lt;P&gt;This would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will go through them and would try to figure out if I could do something more with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 16:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372575#M2078</guid>
      <dc:creator>Skb19121985</dc:creator>
      <dc:date>2017-07-02T16:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372623#M2079</link>
      <description>&lt;P&gt;You can launch Excel from SAS using the X command (or SYSTASK) and a VB Script program. &amp;nbsp;However, this works only when SAS and Excel are on the same machine, and of course, that machine has to be running Windows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are in the (very common) situation where SAS is running on a remote machine (on a server, and perhaps using Linux), then you can't run those X command steps directly. &amp;nbsp;Instead, you would need to copy the Excel file from the SAS server to a Windows machine, and then run the VB Script from there. &amp;nbsp;If you're using SAS Enterprise Guide for all of this, you can actually automate these steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Run a SAS program to generate the Excel file&lt;/LI&gt;
&lt;LI&gt;Use the Data-&amp;gt;Copy Files task to copy the Excel file to the local Windows machine&lt;/LI&gt;
&lt;LI&gt;Use the System Command task (a custom task you can download) to launch the VB Script&lt;/LI&gt;
&lt;LI&gt;If desired, use the Copy Files task again to upload the final Excel file back to the SAS server&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;For a very specific example of using SAS and Excel together for Pivot Tables, &lt;A href="http://blogs.sas.com/content/sgf/2015/03/27/using-sas-to-add-pivottables-to-your-excel-workbook/" target="_self"&gt;see this blog post&lt;/A&gt; from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13736"&gt;@Chevell_sas&lt;/a&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 20:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372623#M2079</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-07-02T20:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Excel VBA Macro using SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372624#M2080</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/146602"&gt;@Skb19121985&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the suggestions. It is in my mind.&lt;/P&gt;
&lt;P&gt;There are different ways to automate the process.&lt;/P&gt;
&lt;P&gt;I wanted to automate SAS and Excel together, to an extent that the only platform I work with would be SAS but I at the same time I take control of Excel using Excel VBA Macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Excel VBA code , I cited in my query was just an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In short, I wanted to execute any Excel VBA Macro using SAS and get desired result in Excel. Ab initio, it is to be understood that no matter whatever be the Excel VBA Macro,&amp;nbsp;it is&amp;nbsp;tested to run error free in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can you assume the VBA macro is something already in your Excel files or do you need to get the VBA code to Excel as well?&lt;/P&gt;
&lt;P&gt;That's the difficult part, otherwise, as long as you have XCMD enabled,&amp;nbsp;calling the VBA is a trivial task and I have code for that can be shared, if required.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Getting VBA to Excel is going to be the issue IMO. I've seen a paper from&amp;nbsp;&lt;EM&gt;Koen&lt;/EM&gt;&lt;SPAN&gt; Vyverman who discusses how to accomplish this (search on Lexjansen.com) but I've found the Excel Template with all my VBA's already is a better mechanism for managing this type of work. Note that you can then save the&amp;nbsp;Excel file as XLSX to remove the macros for your users. Other than the stock template, all of this can be driven from SAS.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There's some info on how I used DDE/Excel + some javascript (for customized page footers/numbers) in this paper.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Edmonton-User-Group/FareezaKhurshed-CoordinateComplexReports-Spring2014.pdf" target="_blank"&gt;https://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Edmonton-User-Group/FareezaKhurshed-CoordinateComplexReports-Spring2014.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2017 20:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Execute-Excel-VBA-Macro-using-SAS/m-p/372624#M2080</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-02T20:33:18Z</dc:date>
    </item>
  </channel>
</rss>

