BookmarkSubscribeRSS Feed
JacquesR
Quartz | Level 8

I am trying to create a plot with data labels on specific points, with 10^-7 displayed in the data label.

 

DATA D_DailyDataForPub;
    SET D_DailyDataForPub;
    IF Date EQ '17OCT2020'D THEN DO;
/* I tried using superscript, but it did not work: */
/*
MaxLabelGE=CATX(" ","17 Oct:",PUT(_g_11dfx5ynpb_GTExt_2020_10_20,8.1),CATT("x 10","(*ESC*){super -7}")); MaxLabelCR=CATX(" ","17 Oct:",PUT(_g_NZCR__GTExt_2020_10_20 ,8.1),CATT("x 10","(*ESC*){super -7}")); MaxLabelER=CATX(" ","17 Oct:",PUT(E_R_GTExt_2020_10_20 ,8.1),CATT("x 10","(*ESC*){super -7}")); */ /* Then I tried unicode */ MaxLabelGE=CATX(" ","17 Oct:",PUT(_g_11dfx5ynpb_GTExt_2020_10_20,8.1),CATT("x 10","(*ESC*){unicode '207B'x}","(*ESC*){unicode '2077'x}")); MaxLabelCR=CATX(" ","17 Oct:",PUT(_g_NZCR__GTExt_2020_10_20 ,8.1),CATT("x 10","(*ESC*){unicode '207B'x}","(*ESC*){unicode '2077'x}")); MaxLabelER=CATX(" ","17 Oct:",PUT(E_R_GTExt_2020_10_20 ,8.1),CATT("x 10","(*ESC*){unicode '207B'x}","(*ESC*){unicode '2077'x}")); END; ELSE DO; MaxLabelGE=" "; MaxLabelCR=" "; MaxLabelER=" "; END; RUN; PROC FREQ DATA=D_DailyDataForPub; TABLE MaxLabel:; RUN;

When I use proc freq, I get the desired result:

 

MaxLabelGE Frequency Percent Cumulative
Frequency
Cumulative
Percent
17 Oct: 380861.3 x 10⁻⁷ 1 100.00 1 100.00
Frequency Missing = 91

 

However, the plot does not display properly:

PROC SGPLOT
    NOBORDER
    DATA=D_DailyDataForPub;
    YAXIS LABEL="Log of Raw search probability (x 10(*ESC*){unicode '2077'x})" VALUES=(0 TO 13 BY 1) RANGES=(0-1 5-13);
    XAXIS TYPE=TIME FITPOLICY=SPLIT INTERVAL=Day ;*VALUESFORMAT=DATETIME10.;
    SERIES X=Date Y=LogElection   /DATALABEL=MaxLabelGE;
    SERIES X=Date Y=LogCannabis   /DATALABEL=MaxLabelCR;      
    SERIES X=Date Y=LogEuthanasia /DATALABEL=MaxLabelER;      
RUN;

Election and Referendums-log.png

Note that the superscript in the y axis label does work.

I have looked at:

https://blogs.sas.com/content/graphicallyspeaking/2011/11/14/the-power-of-unicode/

https://support.sas.com/kb/24/934.html

https://support.sas.com/kb/39/267.html

But I can't get this to work.

 

Any help would be appreciated.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 0 replies
  • 824 views
  • 0 likes
  • 1 in conversation