BookmarkSubscribeRSS Feed
Fluorite | Level 6


I´m really at a loss here. I cannot find any information about my problem online. What I want to do is to create an excel-output (xml-file) with 3 sheets. The last two is where the data is, and the first sheet is like an information page and contains no data but only text.

The code below works, and generates 3 sheets with sheet 1 being blank.

How do I proceed from here? How do I insert text in "Sheet 1" and format it the way I want to (titles bold & larger size, etc)?

Any help appreciated!

Best regards,


ods _all_ close;

ods tagsets.ExcelXP path='path' file="outputfile.xml"


/*Global tagsets*/

ods tagsets.ExcelXP options(embedded_titles='YES'

     print_header='&C&A&RSida &P av &N'

     print_footer='&RUtskrivet &D klockan &T'



     blank_sheet='Sheet 1');

/*Local tagsets*/

ods tagsets.ExcelXP options(sheet_name='Sheet 2');

title4 'Title for sheet 2 & 3';

proc print data=mean_values noobs style(Header)=[just=left];

var var1 var2 var3 var4 / style(Column)=[just=left];

run; quit;

ods tagsets.ExcelXP options(sheet_name='Sheet 3');

proc print data=median_values noobs style(Header)=[just=left];

var var1 var2 var3 var5 var6 var7 / style(Column)=[just=left];

run; quit;

ods tagsets.ExcelXP close;

Super User

I'd make a dataset with the text and use proc report or proc print to output the text.

It can be a dataset with a single variable/observation or it can be a dataset with a single variable and several observations to separate the sentences.

Other options are the ods text= statements but I find that they don't execute until a proc is run so I'm not 100% sure that's an option.

ODS text='put text here';

SAS(R) 9.2 Output Delivery System: User's Guide

Fluorite | Level 6

Thanks for your answer. It was difficult to use the ods text, as you said. I could never get it to write the text string in the output.

If I create a new dataset with multiple observations, and each observation is a sentence, do you know how I can write the proc print code in order to format the observations the way I want? and only show the observations and not the variable name?

I have the dataset:

Data text;

     input Text & $100.;


Text string 1, this is the title

Text string 2, this is the text body



How do I modify the proc print below?

Proc print data=text;

var text;




Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1 like
  • 2 in conversation