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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 984 views
  • 0 likes
  • 3 in conversation