BookmarkSubscribeRSS Feed
amar8580
Calcite | Level 5

hi all

i am new to sas

we have our sas servers on Linux.

is it possible for me using sas enterprise guide to use DDE funtionality

 

 

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Firstly, DDE requires Excel to be installed on the machine, as Excel is not on Linux then no.

Secondly, DDE is decades old and in some setups doesn't work at all - like yours where your on a different OS.

Now, depends what you use the output for.  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.  If it is for review purposes, then you have several options, and you can still create Excel files:

https://communities.sas.com/t5/Base-SAS-Programming/Read-an-Excel-File-in-Linux/td-p/80822

 

amar8580
Calcite | Level 5

thanks for the reply

basically i have a xlsm file that has macro in it

i want to use sas to run that macro

convert that xlsm file in both xlsx and pdf 

and then email it out to users

Kurt_Bremser
Super User

A Excel macro needs Excel to be run. Excel is not available on your SAS server, so forget about it.

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.

ChrisHemedinger
Community Manager

You won't be able to use SAS on Linux to drive this.  If you're using SAS Enterprise Guide, you might be able to drive some of this in a process flow.  You can transfer files to/from Linux with the Copy Files task (in Tools->Data in EG 7.13, available as a custom task in earlier versions).  You can run Windows commands (including scripts to automate Excel) by using the System Command task (a custom task).

 

More on the DDE predicament here.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I see you already have some answers, i.e. no you can't do this on Linux.  Just to add to that, I assume the file will be opened on Windows at some point as this is a review file?  If so why not output your SAS data to CSV and send that with the file.  You macro Excel file can then open the CSV datafile and process it into the spreadsheet using an OnOpen() function.

At the end of the day Excel isn't a good medium, its not cross platform.  You can create PDF directly from SAS.  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.

rogerjdeangelis
Barite | Level 11

If you are familiar with R or python

 

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.

 

 

/* 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="&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 &_loc;
  filename rut pipe  "C:\Python_27_64bit/python.exe &_loc";
  data _null_;
    file print;
    infile rut;
    input;
    put _infile_;
  run;
  filename rut clear;
  filename py_pgm clear;
%mend utl_submit_py64;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2399 views
  • 0 likes
  • 5 in conversation