Data visualization with SAS programming

How to output "≥" in the title for a plot using SAS9.1.3

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

How to output "≥" in the title for a plot using SAS9.1.3

Hi,

I need some help on this:  To output plot into HTML, using device=png.  It is OK for the plot, but I can not work out the way to output  "≥" instead of ">=" for the title.  Here is what I've tried.

 

&#8805 or unicode worked for other HTML setup, but not under the setup where device=png. Do I miss something in the goptions?

Here is the goptions, for complete code please see attached file.

goptions device=png target=png gsfmode=replace gsfname=test

           xmax=8 in ymax=5 in xpixels=800 ypixels=500

           ftext='triplex' gunit=pt htitle=13 htext=13 ;

Any input would be appreciated.

Anna,


Attachment

Accepted Solutions
Solution
‎09-05-2013 10:12 AM
SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

OK - Here's a solution using all "SAS/Graph software fonts" (that are built-in to SAS, even in very early versions).  As before, this assumes you're using gtitles (ie, the title is part of the graph/png/whatever image, rather than being written outside the graph as html)...

It uses the SAS 'math' font, and the >= character is character "M" of that font (which I've never used before in 20+ years), as described on the following doc page:

SAS/GRAPH(R) 9.2: Reference, Second Edition

title1 font=swiss "Here is the " font=math "M" font=swiss " character";

proc gplot data=sashelp.class;
plot height*weight;
run;

View solution in original post


All Replies
SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

How about something like this?...

title1 font="albany amt" "Here is the " f="albany amt/unicode" '2265'x

font="albany amt" " character";

proc gplot data=sashelp.class;

plot height*weight;

run;

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

I am using SAS9.1.3.  It resolves to:   Here is the "e character.

What does it indicate?

Thanks,

Anna

SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

Ahh! - That's a quite old version of SAS, and Unicode isn't supported there.

Support was added to SAS/Graph for unicode in 9.2.

The code I provided will work in 9.2, 9.3, and 9.4 (the current release).

SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

The following should work in 9.1.3 (assuming you're using gtitles) ...

title1 font=swiss "Here is the " f="symbol" 'B3'x font=swiss " character";

proc gplot data=sashelp.class;
plot height*weight;
run;

foo.png

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

Hi Rob,

Doing this following code I got a symbol output but it is extremely small, I can not tell if it is "≥" (unable to upload the image).   How do I enlarge the symbol?

ODS HTML path=odsout body="&pgmname..html";

     title1 font=swiss "Here is the " f="symbol" 'B3'x font=swiss " character";
     title2 h=8.0 j=c "Value &gte. &critx. Fold Rise From Baseline: &cohort.-Year Age Cohort (MITT)";
    footnote1 h=7 j=l "Study:  Output Generation:&sysdate.(&systime.)  Data Extraction: &extdate.";

proc gplot data=f_final1;
  plot pct*xaxi=trt01pn/legend=legend haxis=axis2 name="&pgmname     " des=""
          vaxis=axis1 noframe;
run;

Anna

SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

You should be able to specify heights for each piece of the title:

title1 f=swiss h=12pt "Here is the "    f="symbol" h=20pt 'B3'x    f=swiss h=12pt " character";

proc gplot data=sashelp.class;
plot height*weight;
run;

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

Now can see it very well, still get  Here is the " character.   I think I need some sort of output setup before goptions gplot comes in. 

SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

There are several settings that you might be setting manually, or that might be set automagically without your knowledge, that might be affecting it.

Basically if you are using gtitles (an ods option), and using device=png or device=gif, then this should work. (For example, if you are using device=java or device=activex, then they silently do not support gtitles.)

It might be time to contact tech support, and they will know the questions to ask you, to figure out exactly what combination of settings are affecting what you're seeing.

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

I have updated my existing track for this problem.  Hope will get some feed back from Tech team.

Thanks!

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

I actually got superscript "3" after running the following.  May be what I need is just to find one that translate into "≥".  Can you let me how to find one?

title1 f=swiss h=12pt "Here is the "    f="symbol" h=20pt 'B3'x    f=swiss h=12pt " character";

Thanks!


SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

I recommend again that you work with Tech Support on this one - font issues can be a bit tricky to figure out in older versions of SAS.  The code I posted works for me when I run 9.1.3, but since it isn't working for you, then the way our PC/fonts/SAS is configured must be different.

If you're on a Windows PC, and if you have a Windows font installed, and if SAS is able to use that font, you can use the Windows "Character Map" to determine which numeric code represents which character in the font. You can find out a little more about that on pp. 5-6 of this tutorial I wrote:

http://robslink.com/SAS/book1/Chapter_01_Scatter.pdf

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

I think answer is getting closer with both of your comments.  By the way, I am working on Unix.

SAS tech suggest:  title1  "^S={font_face=symbol} %sysfunc(byte(179))  ^S={} 65 Year of Age (ITT)"; plot age*sex; run; quit;   but escape '^' did not resolved.

Rob's suggest is the way to go: title1 f=swiss h=12pt "Here is the "    f="symbol" h=20pt 'B3'x    f=swiss h=12pt " character";  o nly need to find the right code.

Will follow Jaap Latin-1 to find the right code for Unix.

Any suggestions are very welcome.


SAS Employee
Posts: 963

Re: How to output "≥" in the title for a plot using SAS9.1.3

Ahh! - The Unix part is very important!

*If* you can get SAS 9.2, 9.3, or 9.4 then the first code I posted would be the way to go. In those versions, we install the "albany amt" font with SAS on all platforms, and therefore you can use that same code (and the same font - albany amt) on all platforms, and it "just works".

Since you're using a pre-9.2 version of SAS, you'll need to figure out what (different) font to use on each system (Windows, Unix, etc).  On Unix, I think you can use the 'xlsfonts' Unix command to list the fonts you have available, but I never have done much with trying to use Unix fonts in older SAS versions (I stuck with the SAS/Graph software fonts, such as swiss, swissl, and swissb, etc), so I don't have a lot of insight there.

Contributor
Posts: 30

Re: How to output "≥" in the title for a plot using SAS9.1.3

Hi Rob,

This one works at my settings.  It is clearer to me next time when I encounter similar situation.  Unix is the key.

title1 font=swiss "Here is the " font=math "M" font=swiss " character";

Thanks a lot!!!

Anna

Post a Question
Discussion Stats
  • 18 replies
  • 882 views
  • 6 likes
  • 3 in conversation