BookmarkSubscribeRSS Feed
KevinQin
Obsidian | Level 7
Hi,
I am digging ODS techniques and have some questions:

#1:
What is the difference between ODS MARKUP and ODS TAGSETS?
I think they are the same. Right?

#2:
Is ODS RTF an alias of ODS TAGSETS.RTF?

#3:
Style template is not required to ODS TAGSET output. For example, CSV output do not need style presentation. Right?

#4:
How is the style applied to ODS TAGSET output?

It is easy to understand non-tagset output since we can know destination in advance.

For example, as to same style definition (e.g. bold, red color, etc), TAGSETS.RTF and TAGSETS.EXCELXP must use different control code. How do the style identify this difference?


Any comment will be appreciated.
5 REPLIES 5
Tim_SAS
Barite | Level 11
#1. Essentially yes. The ODS MARKUP statement and the ODS Tagset statement are two different ways to specify the type of markup you want.

#2. No. ODS TAGSETS.RTF is "measured." ODS RTF is not. See http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/a003152286.htm for more information.

#3. The tagset is independent of the style template. If you don't specify a style then the tagset will use the default style if necessary. CSV won't find it necessary, but HTML will.

#4. The style doesn't need to know about the destination. Only the tagset needs to know. The style supplies values to style variables to which the tagset may refer. For example, the BACKGROUND variable has the background color specified by the style.

Hope this helps!
Cynthia_sas
SAS Super FREQ
Hi:
To add .02 on #4. How you actually specify a style is with the STYLE= option. For example to build on Tim's comment:
[pre]
ODS HTML file='will_use_style.html' style=sasweb;
...and...
ODS CSV file='will_NOT_use_style.csv' style=sasweb;
[/pre]

Both of those may appear to work, however, the HTML tagset template was coded to -know- and -use- style elements to build the output file. But the CSV tagset template was coded to -not use- style elements to build the output file. So, just because I specified a style on the ODS CSV invocation, the style specification is irrelevant and unnecessary because ODS CSV or more accurately, the tagset template that is used to create the ODS CSV output file does not use the style template.

You are correct, in your last statement that TAGSETS.EXCELXP and TAGSETS.RTF or HTML all will use different "control codes" or markup tags to specify "bold" versus "red" and how to start a table and how to start a table row. Let's take the SAS title statement for example. You code this:
[pre]
ods listing close;
ods html file='whattitle.html' style=sasweb;
ods tagsets.rtf file='whattitle.rtf' style=sasweb;

title bold c=red "Wombat";
proc print data=sashelp.class(obs=2);
run;
ods _all_ close;
[/pre]

in the HTML file, you will see this markup:
[pre]
<td class="c SystemTitle" style=" font-weight: bold; color: #FF0000;">Wombat</td>
[/pre]

versus this in the RTF file (if you look at it with Notepad):
[pre]
\pard\plain\intbl\sb10\sa10\fs25\cf6\qc\f1\b{Wombat\cell}
[/pre]

So that single TITLE statement from the SAS program got handled as appropriate for each destination. To look at the underlying markup tags or control string information, I opened each output file in Notepad.

You get the different markup because the person who coded the tagset template coded the SystemTitle event to write different markup control strings or tags for each destination. It was probably someone how knew HTML really, really well, who coded the HTML tagset and someone who knew RTF really, really well who coded the RTF tagset. What they needed to know was that the SAS title would be contained in the event variable information for the SystemTitle event. In other words, the information that SAS "sends" to the tagset template controlled destination (or Markup destination) does not change. How each destination HANDLES the event information is what will change.

For a longer discussion of EVENTS and EVENT handling in Tagset Templates, consult the documentation or previous papers on ODS MARKUP and TAGSET Templates.

cynthia
(OK, I guess that was more .05 than .02 worth of adding on...sorry if that's too much information.)
KevinQin
Obsidian | Level 7
Tim and Cynthia, thank you for the reply.

As to the sample code in Cynthia's reply, I have a follow up question.

I think there should be a map table for the style, for example,
"color=red" will be translated into "color: #FF0000;" in html or "\cf6" in rtf.

In the tagsets.rtf, I can position the code at below:

define event data;
/* other statements */
put "\cf" FOREGROUND;
/* other statements */
end;

I have searched FOREGROUND but find nothing in source code of tagsets and styles.
I think it should be a style variable.
My question is where is it defined? Message was edited by: Kevin Qin
Tim_SAS
Barite | Level 11
It's the responsibility of the tagset to convert the style attribute values such as "red" to their equivalent markup representation. That is, the RTF tagset must be able to convert "red" to "\cf6", or whatever is appropriate. HTML is fortunate since color="red" is already a perfectly acceptable attribute.

I see FOREGROUND being used in the cascading_stylesheet tagset, which is an ancestor of the HTML4 tagset. It's lowercased, though, so search for "foreground".

You can find out what style variables are available for each event by running a test program with one of the mapping tagsets such as short_map or event_map. Here's a good paper that describes the process: http://www2.sas.com/proceedings/forum2007/225-2007.pdf.
KevinQin
Obsidian | Level 7
Thank you for the reply. It is helpful.

-Kevin

SAS Innovate 2025: Register Now

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1072 views
  • 0 likes
  • 3 in conversation