<?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: SAS EXCEL DDE in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339208#M22523</link>
    <description>&lt;P&gt;thanks for the reply&lt;/P&gt;&lt;P&gt;basically i have a xlsm file that has macro in it&lt;/P&gt;&lt;P&gt;i want to use sas to run that macro&lt;/P&gt;&lt;P&gt;convert that xlsm file in both xlsx and pdf&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then email it out to users&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2017 13:00:17 GMT</pubDate>
    <dc:creator>amar8580</dc:creator>
    <dc:date>2017-03-08T13:00:17Z</dc:date>
    <item>
      <title>SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339198#M22521</link>
      <description>&lt;P&gt;hi all&lt;/P&gt;&lt;P&gt;i am new to sas&lt;/P&gt;&lt;P&gt;we have our sas servers on Linux.&lt;/P&gt;&lt;P&gt;is it possible for me using sas enterprise guide to use DDE funtionality&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 12:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339198#M22521</guid>
      <dc:creator>amar8580</dc:creator>
      <dc:date>2017-03-08T12:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339204#M22522</link>
      <description>&lt;P&gt;Firstly, DDE requires Excel to be installed on the machine, as Excel is not on Linux then no.&lt;/P&gt;
&lt;P&gt;Secondly, DDE is decades old and in some setups doesn't work at all - like yours where your on a different OS.&lt;/P&gt;
&lt;P&gt;Now, depends what you use the output for. &amp;nbsp;If it is for data transfer, use an open source text based format - CSV, XML, which can be opened by various applications, and is cross platform and robust. &amp;nbsp;If it is for review purposes, then you have several options, and you can still create Excel files:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Read-an-Excel-File-in-Linux/td-p/80822" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Read-an-Excel-File-in-Linux/td-p/80822&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 12:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339204#M22522</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-08T12:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339208#M22523</link>
      <description>&lt;P&gt;thanks for the reply&lt;/P&gt;&lt;P&gt;basically i have a xlsm file that has macro in it&lt;/P&gt;&lt;P&gt;i want to use sas to run that macro&lt;/P&gt;&lt;P&gt;convert that xlsm file in both xlsx and pdf&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then email it out to users&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 13:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339208#M22523</guid>
      <dc:creator>amar8580</dc:creator>
      <dc:date>2017-03-08T13:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339212#M22524</link>
      <description>&lt;P&gt;A Excel macro needs Excel to be run. Excel is not available on your SAS server, so forget about it.&lt;/P&gt;
&lt;P&gt;Export the raw data from Excel into a sensible data format, read that into SAS, and implement the logic from the Excel macro there. That also solves the problem that Excel macros do not adhere to reporting/documentation standards as required by (international) laws and regulations.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 13:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339212#M22524</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-08T13:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339214#M22525</link>
      <description>&lt;P&gt;You won't be able to use SAS on Linux to drive this. &amp;nbsp;If you're using SAS Enterprise Guide, you might be able to drive some of this in a process flow. &amp;nbsp;You can transfer files to/from Linux &lt;A href="http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/" target="_self"&gt;with the Copy Files task&lt;/A&gt; (in Tools-&amp;gt;Data in EG 7.13, available as a custom task in earlier versions). &amp;nbsp;You can run Windows commands (including scripts to automate Excel) &lt;A href="http://blogs.sas.com/content/sasdummy/2007/10/05/you-are-under-my-command-prompt/" target="_self"&gt;by using the System Command task&lt;/A&gt; (a custom task).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2014/10/14/dde-is-doa/" target="_self"&gt;More on the DDE predicament here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 13:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339214#M22525</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-03-08T13:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339231#M22526</link>
      <description>&lt;P&gt;I see you already have some answers, i.e. no you can't do this on Linux. &amp;nbsp;Just to add to that, I assume the file will be opened on Windows at some point as this is a review file? &amp;nbsp;If so why not output your SAS data to CSV and send that with the file. &amp;nbsp;You macro Excel file can then open the CSV datafile and process it into the spreadsheet using an OnOpen() function.&lt;/P&gt;
&lt;P&gt;At the end of the day Excel isn't a good medium, its not cross platform. &amp;nbsp;You can create PDF directly from SAS. &amp;nbsp;And create Excel files but only on Windows, but as mentioned you can create XML files which are cross platform and can be read by Excel.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 13:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339231#M22526</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-08T13:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EXCEL DDE</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339256#M22527</link>
      <description>&lt;P&gt;If you are familiar with R or python&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a related post where I read an XLSM excel workpbook and appen some data to a worksheet.You don't need SAS Access to PC-Files. The free WPS express allows you to export un limited R dataframes or matrices to SAS datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* T0099650 Appending data to an Excel XLSM workbook

SAS Forum: 

Cross posted from SAS-L
You can find a lot of information on dealing with foreign files on SAS-L

http://goo.gl/9OzDmv
https://communities.sas.com/t5/Base-SAS-Programming/export-large-datasets-to-xlsm-file/m-p/294316

HAVE (XLSM formatted Excel file)

1
2
3


SHEET1

WANT (Append 4)

HAVE (XLSM formatted Excel file)

1
2
3
4

SHEET1

SOLUTION

* It might be better to write to another xlsm workbook or
  to write to a temp XLSM and rename it. Unless yoour code is solid
  it is easy to corrupt your original XLSM;

%utl_submit_py64(%nrbquote(
from openpyxl import Workbook;
from openpyxl import load_workbook;
wb = load_workbook(filename='d:/xls/utl_xlsm_sample.xlsm', read_only=False, keep_vba=True);
/* grab the active worksheet */
ws = wb.active;

/* Data can be assigned directly to cells */
ws['A4'] = 88;

wb.save('d:/xls/utl_xlsm_sample.xlsm');
));

SAS MACRO


%macro utl_submit_py64(pgm)/des="Semi colon separated set of py commands";
  * write the program to a temporary file;
  filename py_pgm "%sysfunc(pathname(work))/py_pgm.py" lrecl=32766 recfm=v;
  data _null_;
    length pgm  $32755 cmd $255;
    file py_pgm ;
    pgm="&amp;amp;pgm";
    semi=countc(pgm,';');
      do idx=1 to semi;
        cmd=cats(scan(pgm,idx,';'));
        if cmd=:'.' then cmd=substr(cmd,2);
        put cmd $char96.;
        putlog cmd $char96.;
      end;
  run;
  %let _loc=%sysfunc(pathname(py_pgm));
  %put &amp;amp;_loc;
  filename rut pipe  "C:\Python_27_64bit/python.exe &amp;amp;_loc";
  data _null_;
    file print;
    infile rut;
    input;
    put _infile_;
  run;
  filename rut clear;
  filename py_pgm clear;
%mend utl_submit_py64;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EXCEL-DDE/m-p/339256#M22527</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-08T14:39:58Z</dc:date>
    </item>
  </channel>
</rss>

