Data visualization with SAS programming

Italicizing some letters of the treatment name in figures

Reply
Occasional Contributor
Posts: 14

Italicizing some letters of the treatment name in figures

Hi all,

I’m working on a client request where client wants some letters of the treatment name italicized (eg. 100 µg Na-APR should be displayed as 100 µg Na-APR) in ODS RTF output.

I’m using following code and its working perfectly fine for listings and tables.

 

ods escapechar = "!";

%let Na=%str(!S={font_style=italic}Na!S={});   /*** Italicise Na as per client request ***/

 

Proc report column statement:

 

column p_break day Dateline day orderc ("30 µg &Na.-APR-1 "    Actual1 Change1)

                                  ("100 µg &Na.-APR-1 "  Actual2 Change2);

  

But when I’m using same code for figures, italicizing is not working Smiley Sad

I'm getting following output:

Capture.PNG

 

Any help?

 

 

Grand Advisor
Posts: 10,196

Re: Italicizing some letters of the treatment name in figures

I would not introduce additonal complications of macro language until you have a solution that works so that you generate the correct code with the macro.

 

You might show the code (and preferably some data) that produces the graph. Your code is Proc Report.

 

Here is one way with proc report use the RAW function to insert RTF code for italic text.

ods escapechar="^";

ods rtf file="d:\data\italic.rtf"
style=meadow notoc_data;

proc report data=sashelp.class nowd;
   column ("Some ^{raw \i Measures}" Height Weight);
   define height/display;
   define weight/display;
run;   title;
ods rtf close;
SAS Super FREQ
Posts: 8,716

Re: Italicizing some letters of the treatment name in figures

I am confused about whether the ODS ESCAPECHAR is being used with PROC REPORT (should work) or with ODS GRAPHICS or SAS/GRAPH (will probably NOT work).

cynthia
Occasional Contributor
Posts: 14

Re: Italicizing some letters of the treatment name in figures

First, I'm creating format, then assigning it to dose var, then creating ODS graph template and passing it to PROC SGRENDER.

Here is part of the code used to create the figure.

 

Capture.PNG

Occasional Contributor
Posts: 14

Re: Italicizing some letters of the treatment name in figures

Ooops..looks like I posted wrong dose format statemnt.

The format used is as follows:

 

proc format;
value dose
1="30 µg !S={font_style=italic}Na!S={}-APR-1"
2="100 µg !S={font_style=italic}Na!S={}-APR-1";
quit;

SAS Super FREQ
Posts: 1,078

Re: Italicizing some letters of the treatment name in figures

[ Edited ]

Inline formatting will not work inside GTL.  With SAS 9.4M3, GTL does support unicode in the user defined formats, but you have to use the full ODS ESC string.  There is a HEADERATTRS option to control the font for the entire cell header, but there is no way to make just a portion of the header italic.

 

Now, you could try using a Layout GRIDDED with 2 cells with a DATALATTICE in each.  Not sure if this is supported..  Then, you can use an ENTRY for the dose that does support rich text so you could make just the "Na" in italic.

 

I am curious about columnvar=(dose grp).  This syntax was briefly supported in SAS 9.3 but never documented.  It is not well tested, so you are using a feature that is no longer supported in later releases of SAS. 

Ask a Question
Discussion stats
  • 5 replies
  • 130 views
  • 0 likes
  • 4 in conversation