Can one use the inline formatting to superscript within the text of the INSET statement to the SGPLOT procedure?
268092 ods graphics on / width = 8in height = 5in noborder ;
268093 proc sgplot data = output1.Demo_08 sganno = __sganno dattrmap = dattrmap pad = ( bottom = 20pct left = 10pct ) noborder noautolegend ;
268094 step x = time y = survival / group = group name = "step" attrid = AML_Risk ;
268095 scatter x = time y = censored / group = group markerattrs = ( size = 8pt symbol = plus ) name = "scatter" attrid = AML_Risk ;
268096 inset "AML-High Risk [Days] (95% CI) = 183.00 (113.00, 390.00)"
268097 "AML-Low Risk [Days] (95% CI) = 2204.00 (641.00, NE)"
268098 "`{unicode chi} `{super 2} = 13.45, p-value = 0.0002"
268099 "+ Censored"
268100 / noborder position = topright textattrs = ( size = 7pt family = "Courier New" )
268101 ;
268102 keylegend "step" / location = inside position = bottom noborder ;
268103 xaxis label = "Overall survival (Days)" labelattrs = ( size = 8pt weight = bold family = "Arial" ) valueattrs = ( size = 8pt weight =
268104 normal family = "Arial" ) values = ( 0 to 2500 by 500 ) offsetmin = 0.05 offsetmax = 0 ;
268105 yaxis label = "Survival Probability" labelattrs = ( size = 8pt weight = bold family = "Arial" ) valueattrs = ( size = 8pt weight =
268106 normal family = "Arial" ) offsetmin = 0.1 offsetmax = 0 values = ( 0 to 1 by 0.2 ) ;
268107 format survival percent10. ;
268108 run ;
WARNING 1-322: Assuming the symbol SUP was misspelled as super.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, EVAL, HALIGN, TEXTATTRS, {.
ERROR 76-322: Syntax error, statement will be ignored.
WARNING: Object will not be saved.
Note that if I omit the ODS Escapechar from the superscript: "`{unicode chi} {super 2}", then SAS produces the RTF file.
268122 ods graphics on / width = 8in height = 5in noborder ; 268123 proc sgplot data = output1.Demo_08 sganno = __sganno dattrmap = dattrmap pad = ( bottom = 20pct left = 10pct ) noborder noautolegend ; 268124 step x = time y = survival / group = group name = "step" attrid = AML_Risk ; 268125 scatter x = time y = censored / group = group markerattrs = ( size = 8pt symbol = plus ) name = "scatter" attrid = AML_Risk ; 268126 inset "AML-High Risk [Days] (95% CI) = 183.00 (113.00, 390.00)" 268127 "AML-Low Risk [Days] (95% CI) = 2204.00 (641.00, NE)" 268128 "`{unicode chi}{super 2} = 13.45, p-value = 0.0002" 268129 "+ Censored" 268130 / noborder position = topright textattrs = ( size = 7pt family = "Courier New" ) 268131 ; 268132 keylegend "step" / location = inside position = bottom noborder ; 268133 xaxis label = "Overall survival (Days)" labelattrs = ( size = 8pt weight = bold family = "Arial" ) valueattrs = ( size = 8pt weight = 268134 normal family = "Arial" ) values = ( 0 to 2500 by 500 ) offsetmin = 0.05 offsetmax = 0 ; 268135 yaxis label = "Survival Probability" labelattrs = ( size = 8pt weight = bold family = "Arial" ) valueattrs = ( size = 8pt weight = 268136 normal family = "Arial" ) offsetmin = 0.1 offsetmax = 0 values = ( 0 to 1 by 0.2 ) ; 268137 format survival percent10. ; 268138 run ; NOTE: PROCEDURE SGPLOT used (Total process time): real time 0.76 seconds cpu time 0.43 seconds NOTE: There were 112 observations read from the data set OUTPUT1.DEMO_08. NOTE: There were 2 observations read from the data set WORK.DATTRMAP.
Thank you,
Kevin
You must use the escape sequence (*ESC*)
You must use the escape sequence (*ESC*)
Well that worked:
(*ESC*){unicode chi}(*ESC*){sup '2'}
Note that 2 is quoted, but I used single quotations because this become a double-quotation mark text-string for the INSET statement:
INSET "text-string" <... "text-string-n"> </options>;
Note, however, so did `{unicode chi}`{super '2'}, where my ODS ESCAPECHAR is "`".
So my issue was that I did not quote the argument (?):
SAS documentation:
ODS ESCAPECHAR Statement
Using the ODS ESCAPECHAR Functions
Here is the syntax for the ODS ESCAPECHAR functions:
escape-character{function-name <<arg-1 <arg-2<arg-n>>>> }
SUPER Function
^{SUPER <superscript-value>}
superscript-value
can be a numeric, alphanumeric, or a character value. This value is written above and immediately to one side of another character.
Always ecstatic and humbled to hear from you data _null_!
Thank you,
Kevin
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.