Data visualization with SAS programming

ODS tagset excelxp - how to get text and sentences into a blank sheet?

Reply
Contributor
Posts: 35

ODS tagset excelxp - how to get text and sentences into a blank sheet?

Hi,

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,

Hank

ods _all_ close;

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

style=Printer;

/*Global tagsets*/

ods tagsets.ExcelXP options(embedded_titles='YES'

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

     print_footer='&RUtskrivet &D klockan &T'

     autofilter='all'

     frozen_headers='YES'

     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;

Grand Advisor
Posts: 17,464

Re: ODS tagset excelxp - how to get text and sentences into a blank sheet?

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

Contributor
Posts: 35

Re: ODS tagset excelxp - how to get text and sentences into a blank sheet?

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.;

     datalines;

Text string 1, this is the title

Text string 2, this is the text body

;

run;

How do I modify the proc print below?

Proc print data=text;

var text;

run;


Ask a Question
Discussion stats
  • 2 replies
  • 679 views
  • 1 like
  • 2 in conversation