BookmarkSubscribeRSS Feed
Nupur20
Calcite | Level 5

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!

4 REPLIES 4
art297
Opal | Level 21

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

Nupur20
Calcite | Level 5

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;

art297
Opal | Level 21

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

chemicalab
Fluorite | Level 6

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;

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1015 views
  • 0 likes
  • 3 in conversation