BookmarkSubscribeRSS Feed
maggi2410
Obsidian | Level 7

Hi,

I have three datasets, and I am exporting the data to excel using libname AS FOLLOWS:

libname excl "..\export\&infl.";

data excl.Sheet1(dblabel=yes);

   set FINAL1;

run;

Now the problem is I have three datasets final1, final2, final3.While exporting to excel I have to create thrree tabs with these three datasets and rename the exc el tab as :

Base-line(Geno), Post-Bl(Geno) etc etc.. ie with Hyp[hen and brackets. How can I do that?

I can use libname statement only to export data as My data has very long character fields.

Thanks!

3 REPLIES 3
PGStats
Opal | Level 21

Use a name literal, such as :

data excl.'Base-line(Geno)'n (dblabel=yes);

PG

PG
maggi2410
Obsidian | Level 7

It doesnt work. Excel converts hypehn and bracket to underdcores...Smiley Sad

Cynthia_sas
SAS Super FREQ

Hi:

  ODS does offer you an alternative. Look at the sheet names in the attached screenshot. They were produced with the code shown below.

  Instead of your DATA step program, you would replace my PROC PRINT with a PROC PRINT for each dataset that you wanted to create as a sheet in the workbook.

cynthia

ods listing close;

title;

ods tagsets.excelxp file='c:\temp\testname.xml'

    style=sasweb;

 

ods tagsets.excelxp options(sheet_name='Base-line(Geno)');

proc print data=sashelp.shoes(obs=3);

run;

 

ods tagsets.excelxp options(sheet_name='Post-Bl(Geno)');

proc print data=sashelp.cars(obs=3);

run;

 

ods tagsets.excelxp close;


use_sheet_name_excelxp.png

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