DATA Step, Macro, Functions and more

Export data to excel

Reply
Contributor
Posts: 33

Export data to excel

Hi,

I want to export my sas dataset to specific cells in excel.

I am trying to use macro but everytime I run it, my sas stops responding.

Can anyone tell me the macro statement for exporting?

Thanks a ton!

PROC Star
Posts: 7,492

Export data to excel

No one can help you if you don't post your code.

Contributor
Posts: 33

Export data to excel

yes. my code looks like this

%macro export ();

filename syscmd dde 'Excel|system';

    data _null_;

      file syscmd;

      put '[file-open("H:\SAS\survey\Reports\sas.xls")]';

    run;

          filename Q1C DDE "Excel|Sheet1!R1C1";

data _null_;

set Q1;

if role = 'C';

file Q1C notab;

put count '09x' percent '09x';

run;

%end;

%mend export;

%export;**Run macro;

PROC Star
Posts: 7,492

Re: Export data to excel

According to your code, you are forcing everything into Row 1, Column1.  If you have to use DDE, I'd suggest reading some of the key papers that have been written regarding that method.  Do a Google search for Vyverman sas dde excel

Frequent Contributor
Posts: 126

Re: Export data to excel

i would use this

libname xlsout  odbc noprompt="dbq=path\name of excel file you want to create ;

              driver={microsoft excel driver (*.xls)}; readonly=0";

    data xlsout.tabname;

        set (data for export);

    run;

    libname xlsout clear;

    run;

    quit;

Ask a Question
Discussion stats
  • 4 replies
  • 251 views
  • 0 likes
  • 3 in conversation