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;
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';
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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.