Data visualization with SAS programming

UNICODE in tickValueLabels?

Accepted Solution Solved
Reply
Respected Advisor
Posts: 3,768
Accepted Solution

UNICODE in tickValueLabels?

Can you do it? How do you do it?


Accepted Solutions
Solution
‎01-03-2012 10:55 AM
SAS Super FREQ
Posts: 864

UNICODE in tickValueLabels?

You can do this in GTL by using a combination of TICKVALUELIST and TICKDISPLAYLIST on a LINEAR axis. The first option sets the tick values and the second option specifies overriding text. TICKDISPLAYLIST must be used in conjunction with TICKVALUELIST or the TICKDISPLAYLIST will be ignored. The overriding text can contain a combination of regular text and Unicode text. The Unicode text is specified using the ODS ESCAPECHAR syntax. Here is a little example:

data a;
x=1; value=15; output;
x=2; value=20; output;
x=3; value=25; output;
x=4; value=30; output;
run;

proc template;
  define statgraph a;
  begingraph;
      entrytitle 'Unicode Tick Value Example';
      layout overlay / xaxisopts=(linearopts=(integer=true
                       tickvaluelist=(1 2 3 4)
                       tickdisplaylist=("Alpha ~{unicode alpha}"
                                        "Beta ~{unicode beta}"
                                        "Male ~{unicode '2642'x}"
                                        "Female ~{unicode '2640'x}")));
          scatterplot x=x y=value;
        endlayout;
      endgraph;
  end;
run;

ods escapechar='~';
proc sgrender data=a template=a;
run;

View solution in original post


All Replies
SAS Employee
Posts: 963

UNICODE in tickValueLabels?

The following works for me with Proc Gplot and dev=png in SAS 9.3 ...

data a;

foo='263b'x; value=15; output;

foo='2206'x; value=20; output;

foo='2640'x; value=25; output;

foo='2642'x; value=30; output;

run;

 

axis1 value=(font="albany amt/unicode");

proc gplot data=a;

plot value*foo / haxis=axis1;

run;

Respected Advisor
Posts: 3,768

UNICODE in tickValueLabels?

GTL version 9.2 got any ideas for that.

SAS Employee
Posts: 963

UNICODE in tickValueLabels?

Sorry - I'll have to leave that to Sanjay & Dan! Smiley Happy

Solution
‎01-03-2012 10:55 AM
SAS Super FREQ
Posts: 864

UNICODE in tickValueLabels?

You can do this in GTL by using a combination of TICKVALUELIST and TICKDISPLAYLIST on a LINEAR axis. The first option sets the tick values and the second option specifies overriding text. TICKDISPLAYLIST must be used in conjunction with TICKVALUELIST or the TICKDISPLAYLIST will be ignored. The overriding text can contain a combination of regular text and Unicode text. The Unicode text is specified using the ODS ESCAPECHAR syntax. Here is a little example:

data a;
x=1; value=15; output;
x=2; value=20; output;
x=3; value=25; output;
x=4; value=30; output;
run;

proc template;
  define statgraph a;
  begingraph;
      entrytitle 'Unicode Tick Value Example';
      layout overlay / xaxisopts=(linearopts=(integer=true
                       tickvaluelist=(1 2 3 4)
                       tickdisplaylist=("Alpha ~{unicode alpha}"
                                        "Beta ~{unicode beta}"
                                        "Male ~{unicode '2642'x}"
                                        "Female ~{unicode '2640'x}")));
          scatterplot x=x y=value;
        endlayout;
      endgraph;
  end;
run;

ods escapechar='~';
proc sgrender data=a template=a;
run;

Respected Advisor
Posts: 3,768

UNICODE in tickValueLabels?

Thanks so much Dan.  My application was DISCRETEOPTS of ROWAXISOPTS in LAYOUT DATAPANEL.  Your message implied that it was only for LINEAR axis but the option worked in DISCRETEOPTS and I am good with that!

SAS Super FREQ
Posts: 1,044

UNICODE in tickValueLabels?

These options should be used with caution.  As long as all the tick values appearing on the axis are included in the TICKVALUELIST, you are OK.  You can reorder the values and even use a subset.  But if you have additional values in the list (that are not in the data) the results may be unpredictable.

SAS Employee
Posts: 963

UNICODE in tickValueLabels?

I agree with Sanjay - I have seen many times where hard-coded values in an axis statement, etc are not kept in-sync with the data, and then the graph is incorrect (compromising the data integrity).

The advantage of a data-driven solution (where the actual values in the data set are plotted, such as the Gplot one I posed) is that the graph is always guaranteed to match the data (no risk of human error, keeping hard-coded values in sync with your data).

Respected Advisor
Posts: 3,768

Re: UNICODE in tickValueLabels?

I would be happy with a data driven approach but as I understand it the only way to get unicode characters in the tick labels is to use the TICKDISPLAYLIST subparameter (not sure the exact classification of TICKDISPLAYLIST).

I suppose my program is data driven in that the TICKVALUELIST and TICKDISPLAYLIST are code gennned from the data. Maybe I won't get it too wrong.:smileyplain:

Post a Question
Discussion Stats
  • 8 replies
  • 344 views
  • 0 likes
  • 4 in conversation