DATA Step, Macro, Functions and more

Exporting data from sas 9.1 to excel 2007 Using dde

Reply
Contributor
Posts: 20

Exporting data from sas 9.1 to excel 2007 Using dde

Hey everyone !
I 'm trying to export some data from sas to excel using dde. Here is my code :

Options noxwait noxsync ;
X ' start excel' ;

Data _null_ ;
Rc = sleep(3);
Run ;
/* openning my xls file : note that i created a xls file */

Filename export dde "excel|system" ;
Data _null_ ;
File export ;
Put '[open("filepath\filename.xls")]';
Run ;

/*Selecting the range in my xls file where to export data */

Filename range dde "excel|sheet1! R1c1:r2c67" ;

Data _null_ ;
Set sashelp.workers ;
File range ;
Put date electric /* columns to export */ ;
Run ;


When i open my xls file nothing is exported,the file is empty but the log says that everything is exported as it should be. I can't figure why, can you help me ?

Ps : i work with sas 9.1 and excel 2007 ( the file is a xlsx saved as xls)

Thank you for your help.

Super User
Super User
Posts: 8,120

Re: Exporting data from sas 9.1 to excel 2007 Using dde

You have a command to open the file, but I don't see one to save the file.

Respected Advisor
Posts: 4,736

Re: Exporting data from sas 9.1 to excel 2007 Using dde

@Raitag

Before implementing new code using DDE you probably should read this article:

https://blogs.sas.com/content/sasdummy/2014/10/14/dde-is-doa/  

Ask a Question
Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 3 in conversation