SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bnawrocki
Quartz | Level 8

This code used to work in Windows SAS 9.4 - that is, I saw a superscript 1 in both title and data.

But running this in Linux SAS Viya, it doesn't.

The TITLE statement works OK - I see the Superscript 1.

But in the "Age" column, if age < 14, I don't see Superscript 1 - I see a Superscript with a generic-looking degree (zero?) sign.

How can I conditionally add Superscript 1 to end of Age?

Note: I also tried {Unicode '00B9'x} -- but same results.

proc format;
	picture myPic
		low -< 14 = "000,009.9(*ESC*){super 1}" 
		other = '000,009.9'; 
run;

title "Title containing a superscript(*ESC*){super 1}";
proc print data=sashelp.class;
  format age myPic.;
run;


 

Here is the output from Results window. Note Age in Obs 2 has wrong superscript!

Title containing a superscript1

 Obs Name Sex Age Height Weight

AlfredM14.069.0112.5
AliceF13.0056.584.0

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @bnawrocki,

 

A third approach is to type the superscript 1 as ¹ directly into the code, which can be done with Alt+0185 at least under Windows. (Unfortunately I have neither a Linux nor a SAS Viya test environment available.) Interestingly, this is the only approach (among the three suggestions) that works with my Windows SAS 9.4M5 using HTML output:

superscript1.png

 

I don't know why the resulting HTML code differs between title and table and why it contains zeros or degree signs ("&#176;") in the table cells when clearly a "1" or "¹" (='B9'x) was requested. (Also note the ugly vertical alignment when using the first approach.)

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @bnawrocki,

 

A third approach is to type the superscript 1 as ¹ directly into the code, which can be done with Alt+0185 at least under Windows. (Unfortunately I have neither a Linux nor a SAS Viya test environment available.) Interestingly, this is the only approach (among the three suggestions) that works with my Windows SAS 9.4M5 using HTML output:

superscript1.png

 

I don't know why the resulting HTML code differs between title and table and why it contains zeros or degree signs ("&#176;") in the table cells when clearly a "1" or "¹" (='B9'x) was requested. (Also note the ugly vertical alignment when using the first approach.)

bnawrocki
Quartz | Level 8

@FreelanceReinh  Thanks for checking into this!

Yes, that's what I had to do - I had originally typed Alt-0185 into both strings to get the superscript 1 to display in my Windows SAS reports. But when I copied that SAS code from Windows to Linux and opened the SAS code in SAS Studio there, the 1's had been replaced by a weird "question-mark-in-black-diamond" character. To fix that, in SAS Studio, I typed Alt-0185 over that weird character, and the SAS code now works in Linux SAS.

 

I'll just have to remember to not copy SAS code between Windows and Linux with these special characters.

I was hoping either the {SUPER} or {UNICODE} trick would work on both Windows and Linux, but no such luck, at least in this case.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 2 replies
  • 1020 views
  • 4 likes
  • 2 in conversation