BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
data_null__
Jade | Level 19

Can you do it? How do you do it?

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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

8 REPLIES 8
GraphGuy
Meteorite | Level 14

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;

data_null__
Jade | Level 19

GTL version 9.2 got any ideas for that.

GraphGuy
Meteorite | Level 14

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

DanH_sas
SAS Super FREQ

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;

data_null__
Jade | Level 19

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!

Jay54
Meteorite | Level 14

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.

GraphGuy
Meteorite | Level 14

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).

data_null__
Jade | Level 19

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:

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 2114 views
  • 0 likes
  • 4 in conversation