Hi
I am writing a stored process that is called from a PowerPoint presentation. The result is streamed, and in the SAS Report XML format.
What i would like to do is format the labels of a dataset, and I have tried things like
ods escapechar='^';
proc report data=sashelp.class missing nowd;
columns ( ("^S={font_weight=bold} Students ^S={font_style=italic }name ^S={}" name) sex age);
define name / width=130;
run;
That works perfectly when run in EG or with some other ods output. In my case however, this gives me a label without style/format, and with the "S={}" written in text.
"S={font_weight=bold} Students
S={font_style=italic }name
S={}"
Is there any way to format specific parts of a text in sasreport xml? I can format whole columns using
call define(_col_,"style","style=[font_size=10pt foreground=green ]");
Thanks
Sofie
Hi:
PowerPoint can only receive SASReport XML as the results from a Stored Process. Generally, this means that the SASReport XML is controlled by the style definitions that are used for the Platform. Any style information or instruction that is not recognized by the destination is ignored. So, your CALL DEFINE works, because it makes the change using a supported technique. I have not used ODS ESCAPECHAR within a stored process and PowerPoint, so I'm not sure whether that capability is a supported technique for SASReport XML. When I try your original code using EG and choosing SASReport as my result format for EG, I do see that the changes are being used by EG, when EG renders the SASReport XML for viewing. Perhaps there is something different between rendering the XML for PowerPoint that doesn't work the same as when rendering is done for EG. That would be a question for Tech Support. They can test the code in both EG and the PowerPoint to try to determine why your code works with SASReport format in EG, but not in PowerPoint.
I notice that you are using the older ESCAPECHAR syntax and not the newest syntax. So, for example, once you have declared your escape character:
ods escapechar='^';
this is the original syntax (with ^S=):
columns ( ("^S={font_weight=bold} Students ^S={font_style=italic }name ^S={}" name) sex age);
while the newer syntax would be more like a function call:
columns ( ("^{style[font_weight=bold] Students ^{style[font_style=italic]name}}" name) sex age);
However, I am confused about what you are trying to do. . Your sample syntax produces this output (see screenshot) and that doesn't make a lot of sense to me. It looks to me like you are using a spanning header. Usually, the header text is already a bold font weight. So you want only the string "name" to be italic, but still bold? I've attached a screen shot of what your code produces and the duplicate appearance of the string "name" is confusing.
You might want to consider working with Tech Support on this question, if the original syntax is not working with SASReport XML and PowerPoint, I don't know, without testing, whether the newer syntax would work with SASReport XML destination in PowerPoint or not..
However, without using ODS ESCAPECHAR, I am posting an alternate possibility, where the text "Students" is spanning all 3 columns and the text for each column header is different. I used standard style= overrides (not ODS ESCAPCHAR), which might work better with SASReport XML and PowerPoint output (I think that you have to be sure that the PowerPoint option to use styles is turned on in order for the SAS style to be used instead of the PowerPoint style.) Also, you might want to be absolutely sure that your ODS ESCAPECHAR statement is declared in your stored process. If the ESCAPECHAR is not declared, you might have the type of issues you describe, too. The "universal" ESCAPECHAR is (*ESC*) So instead of
^{style[font_weight=bold] string} you would have
(*ESC*){style[font_weight=bold] string}
you would have
To open a track with Tech Support, fill out the form at this link:
http://support.sas.com/ctx/supportform/createForm
cynthia
alternate syntax (tried in Base SAS, not as a stored process):
ods html file='c:\temp\headers.html';
proc report data=sashelp.class nowd;
columns ("Students" name sex age);
define name / order 'name'
style(header)={font_weight=bold font_style=italic};
define sex / display 'gender'
style(header)={color=purple textdecoration=underline};
define age / display 'age'
style(header)={color=green font_style=italic};
run;
ods html close;
Thanks for your answer! I will try the newer syntax.
I can see how my example would be confusing. This wast just an example, and I didn't choose my word carefully. What I actually want to do isn't even to produce a spanning header, but only to format words in one label (column header) with several formats. So yes, I want to be able to have one word in a label bold while the rest of the text is unbold, but not really in a spanning header. Do you know of any way to do this? (I've attached a picture of the result I want)
About the ESCAPECHAR, it is definitely set, and the text is divided in new rows for each "^" (a side effect that I was not looking for).
With the new syntax, I can now get the result I want when running the stored process in EG. Unfortunately, the format is not applied in PowerPoint, but at least the "^{style[font_weight=bold]" part of the text is not visible anymore. I have opened a Tech Support track about the difference in results.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.