Help using Base SAS procedures

export to excel by file

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 80
Accepted Solution

export to excel by file

Hi everyone

I am exporting a data set to excel using this data step

data _null_;
set ERS_CMP.CMP_ERS_MQ12 (obs = 100);
file "/CEGSAS/ERS/MQ12_TESTE.xls";
put (_all_) (Smiley Happy;
run;

The question is:

Is it a way to export to excel when you don't have the excel engine, or do i really need to have a excel engine

to export datas to excel?

I opened the MQ12_TESTE.xls but the values looks like as txt file.

Thanks


Accepted Solutions
Solution
‎02-14-2012 01:56 PM
PROC Star
Posts: 7,363

export to excel by file

I happen to prefer using the excel engine.  However, you may be able to accomplish what you need by using the ExcelXP tagset.  Take a look at: http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html

View solution in original post


All Replies
Solution
‎02-14-2012 01:56 PM
PROC Star
Posts: 7,363

export to excel by file

I happen to prefer using the excel engine.  However, you may be able to accomplish what you need by using the ExcelXP tagset.  Take a look at: http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html

Frequent Contributor
Posts: 80

export to excel by file

Mr. art

To do exports to excel do I need to have SAS/ACCESS?

PROC Star
Posts: 7,363

export to excel by file

Not with the tagsets

Frequent Contributor
Posts: 80

export to excel by file

Hi Mister Art. I have a question regarding to tagsets.excelxp. When i run the second code below, the first sheet1 doesn't appear in the want.xls file, I mean is overwrited by the second execution. Is the a way to insert datas into many sheets using tagsets.excelxp? I do need to have more than one ods tagsets command because each one is belongs to its proccess.


ods tagsets.excelxp file = "c:\want.xls"  options (sheet_name = 'sheet1');

     proc print data = have1 noobs;

     run;

ods tagsets.excelxp close;

ods tagesets.excelxp file = "c:\want.xls" options (sheet_name = 'sheet2');

  proc print data = have2 noobs;

  run;

ods tagsets.excelxp close;

PROC Star
Posts: 7,363

export to excel by file

Augusto: try it after commenting out the first close statement.  i.e.:

ods tagsets.excelxp file = "c:\art\want.xls"  options (sheet_name = 'sheet1');

     proc print data = sashelp.class noobs;

     run;

*ods tagsets.excelxp close;

ods tagesets.excelxp file = "c:\art\want.xls" options (sheet_name = 'sheet2');

  proc print data = sashelp.class noobs;

  run;

ods tagsets.excelxp close;

BTW, It is either Dr. Art or just Art.  "Mister" makes me feel to old Smiley Happy

Frequent Contributor
Posts: 80

export to excel by file

Hi Dr. Art.

Well, I guees..I am in trouble, because actually I have these codes separated each one in its process. not like I've shown here. I have one process called export_data1.sas and other export_data2.sas that must be processed separated and the results are exported to the same excel in separated sheets.

PROC Star
Posts: 7,363

export to excel by file

Why not just save the resulting file from the first process as a permanent file then, when you run the second process, print both files?

Frequent Contributor
Posts: 80

export to excel by file

I will do this. Is the only way.

Here in Brazil we usually call Mister those we think that have the power to know.Smiley Happy

Thanks Art

Frequent Contributor
Posts: 80

export to excel by file

thanks art. you helped me again.

Super User
Posts: 3,106

export to excel by file

Try changing the file extension from XLS to CSV. That way when you double click on the file in Windows Explorer Excel should recognise it as a delimited file.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 256 views
  • 0 likes
  • 3 in conversation