<?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: How do I proc export to a macro activated Excel workbook in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325665#M271443</link>
    <description>&lt;P&gt;There are many topics on here on this very subject. &amp;nbsp;Its not easy, and depends on what version of SAS etc. &amp;nbsp;Do a search. &amp;nbsp;My advice, dump the data from SAS to CSV, then in your Excel file have a small bit of VBA to load that CSV and process in your Excel file.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2017 13:39:59 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-01-18T13:39:59Z</dc:date>
    <item>
      <title>How do I proc export to a macro activated Excel workbook</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325652#M271442</link>
      <description>&lt;P&gt;I'm trying to export a dataset to a macro activated Excel workbook Code below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;export&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbms&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=Excelcs&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=db_final&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;outfile&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"\\My_computer\KPM\Output\KPM_DK_Business.xlsm"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;replace&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SHEET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Data1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;server&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"My_server"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;port&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;9621&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workbook already exist, and so does sheet "Data1". I want to overwrite the existing "Data1" with the new export using "replace". But SAS creates a new&amp;nbsp;sheet called "Data11" where it outputs the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I straighten this out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(SAS version 9.4 and exporting to Excel 2010)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate all the help I can get!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;August&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 12:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325652#M271442</guid>
      <dc:creator>AugustV</dc:creator>
      <dc:date>2017-01-18T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I proc export to a macro activated Excel workbook</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325665#M271443</link>
      <description>&lt;P&gt;There are many topics on here on this very subject. &amp;nbsp;Its not easy, and depends on what version of SAS etc. &amp;nbsp;Do a search. &amp;nbsp;My advice, dump the data from SAS to CSV, then in your Excel file have a small bit of VBA to load that CSV and process in your Excel file.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 13:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325665#M271443</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-18T13:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I proc export to a macro activated Excel workbook</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325669#M271444</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SAS Forum: How do I proc export to a macro activated Excel workbook

https://goo.gl/CPxDyB
https://communities.sas.com/t5/General-SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325652


HAVE EXISTING MACRO XLS NOTEOOK ANA WANT TO UPDATE AN EXISTING SHEET

Sheet CLASS

 +-------------------------+
 |      |    A      |   B  |
 +------+------------------+
 |      |           |      |
 |    1 |   NAME    |   AGE|
 |    2 |   Alfred  |   14 |
 |    3 |   Alice   |   13 |
 |    4 |   Barbara |   13 |
 |    5 |   Carol   |   14 |
 |    6 |   Henry   |   14 |
 +------------------+------+

CLASS


MANUALLY PLACE MACROS ARE IN THE WORKBOOK

/* T000225 CONVERTING ALL EXCEL CELLS TO CHARACTER  */
    Latest VBA macros Addticks - forces all excel cells to be character
    before importing excel sheets to SAS this macro should be used

   /* this will stop when cell has TIUQ which is quit backwards */
   /* this is probably the best macro */
   Sub AddTicks()
    Dim LastPlace, Z As Variant, X As Variant
    LastPlace = ActiveCell.SpecialCells(xlLastCell).Address
    ActiveSheet.Range(Cells(1, 1), LastPlace).Select
    Z = Selection.Address   'Get the address
        For Each X In ActiveSheet.Range(Z)  'Do while
            If Len(X) &amp;gt; 0 Then      'Find cells with something
                X.FormulaR1C1 = Chr(39) &amp;amp; Mid(X, 1, Len(X))  '39 is code for tick
            Else
                X.FormulaR1C1 = ""  'If empty do not put tick
            End If
            If X = "TIUQ" Then
                Exit Sub
            End If
        Next
   End Sub

/* T000226 REMOVES TICKS FROM EXCEL CELLS  */
    Sub RemoveTicks()
    For Each currentcell In Selection
        If currentcell.HasFormula = False Then
            'Verifies that procedure does not change the
            'cell with the active formula so that it contains
            'only the value.
            currentcell.Formula = currentcell.Value
        End If
    Next
    End Sub


WANT UPDATE MUTIPLY AGE BY 2
=================================


 +-------------------------+
 |      |    A      |   B  |
 +------+------------------+
 |      |           |      |
 |    1 |   NAME    |   AGE|
 |    2 |   Alfred  |   14 |
 |    3 |   Alice   |   13 |
 |    4 |   Barbara |   13 |
 |    5 |   Carol   |   14 |
 |    6 |   Henry   |   14 |
 +------------------+------+

 CLASS

 SOLUTION (WORKING CODE)

   modify xel.class(keep=name age);
   age=age*2;


FULL SOLUTION

* Create the workbook;

libname xel "d:/xls/class.xlsx";

data xel.class;
  set sashelp.class(keep=name age);
run;quit;

* close to save ;
libname xel clear;

* note xlsb;
libname xel excel "d:/xls/class.xlsb" scantext=no;

data xel.class;
   modify xel.class(keep=name age);
   age=age*2;
run;

libname xel clear;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jan 2017 13:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325669#M271444</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-01-18T13:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I proc export to a macro activated Excel workbook</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325673#M271445</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Correction WANT SHOULD BE

 +-------------------------+
 |      |    A      |   B  |
 +------+------------------+
 |      |           |      |
 |    1 |   NAME    |   AGE|
 |    2 |   Alfred  |   28 |
 |    3 |   Alice   |   26 |
 |    4 |   Barbara |   26 |
 |    5 |   Carol   |   28 |
 |    6 |   Henry   |   28 |
 +------------------+------+

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jan 2017 14:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-proc-export-to-a-macro-activated-Excel-workbook/m-p/325673#M271445</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-01-18T14:11:34Z</dc:date>
    </item>
  </channel>
</rss>

