BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PaigeMiller
Diamond | Level 26

Suppose I want to use UNICODE characters in PROC SGPLOT. Can it be done?? My initial attempts to do so failed.

 

Example: Unicode 2265 (greater than or equal to) shows up properly in PROC PRINT

 

ods escapechar='~';
proc format;
    value weightf 0-59='<60'  60-high='~{unicode 2265}60';
run;
proc print data=sashelp.class;
    id name;
    var weight;
    format weight weightf.;
run;

 

PaigeMiller_0-1658165772236.png

 

but now PROC SGPLOT doesn't show the greater than or equal to sign. Can it be done? If so, how?

 

proc sgplot data=sashelp.class;
    vbar weight/response=height;
    format weight weightf.;
run;

PaigeMiller_1-1658165831955.png

 

--
Paige Miller
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello Paige,

 

For me it works if I use the "(*ESC*)" notation instead of the ODS ESCAPECHAR in the PROC FORMAT step

 

value weightf 0-59='<60'  60-high="(*ESC*){Unicode '2265'x}60";

(as @Ksharp did three days ago in another thread -- credit to him).

 

View solution in original post

10 REPLIES 10
pink_poodle
Barite | Level 11
This will work if instead of formatting existing variable you create a new categorical variable with values "<60" and ">=60".
PaigeMiller
Diamond | Level 26

@pink_poodle wrote:
This will work if instead of formatting existing variable you create a new categorical variable with values "<60" and ">=60".

 

Not seeing it, still not working, unless I'm still doing something wrong.

 

ods escapechar='~';
proc format;
    value weightf 0-59='<60'  60-high='~{unicode 2265}60';
run;
data class;
    set sashelp.class;
    weight1=vvalue(weight);
    format weight weightf.; 
run;
proc sgplot data=class;
    vbar weight1/response=height;
run; 

 

--
Paige Miller
pink_poodle
Barite | Level 11

data cat;
     set sashelp.class;
     if weight >= 60 then wcat = ">=60";
     else if not missing(weight) and weight < 60 then wcat = "<60";
run;

proc sgplot data=cat;
    vbar wcat / response=height;
run;

PaigeMiller
Diamond | Level 26
if weight >= 60 then wcat = '>=60';

This is not what I wanted. I want one character which is the greater than or equal symbol; it is not the two characters you typed. 

--
Paige Miller
RichardDeVen
Barite | Level 11

You can run SAS (Unicode Support) using icon or startup option

-CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg"

In your code paste the special symbol (≥) directly.  SGPLOT will honor the special character in the source code.

ods graphics / width=300px;

proc format;
    value weightf 0-59='< 60'  60-high='≥ 60';    
run;
proc print data=sashelp.class;
    id name;
    var weight;
    format weight weightf.;
run;
proc sgplot data=sashelp.class;
    vbar weight / response=height;
    format weight weightf.;
run;

RichardADeVenezia_0-1658167501498.png

 

 

 

PaigeMiller
Diamond | Level 26

@RichardDeVen wrote:

You can run SAS (Unicode Support) using icon or startup option

-CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg"

Please explain what this means.

 

 

In your code paste the special symbol (≥) directly. 

 

Please explain how to do this. (And please explain how to do this with other unicode characters that I might want to use some day).

--
Paige Miller
RichardDeVen
Barite | Level 11

In Windows 10 in the Start menu scroll down to the S group open the SAS folder and see the SAS 9.4 (Unicode Support) icon

RichardADeVenezia_0-1658168451065.png

The icon is a shortcut to the command that runs SAS in Unicode mode

 

"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg"

Note: Use the right mouse button to pin the icon to the Windows Start Menu or Task bar. You can also use the Windows search bar and type "Unicode Support" to find the icon.

 

 

I use a website such as https://unicode-table.com to find the Unicode characters I want to Copy and Paste into my SAS editor, or text files (Notepad++)

 

PaigeMiller
Diamond | Level 26

Thank you for the explanation @RichardDeVen 

 

I always have used the SAS 9.4 (English) with a custom autoexec, what is different if I use SAS 9.4 (Unicode)? What do I gain or lose?

--
Paige Miller
FreelanceReinh
Jade | Level 19

Hello Paige,

 

For me it works if I use the "(*ESC*)" notation instead of the ODS ESCAPECHAR in the PROC FORMAT step

 

value weightf 0-59='<60'  60-high="(*ESC*){Unicode '2265'x}60";

(as @Ksharp did three days ago in another thread -- credit to him).

 

PaigeMiller
Diamond | Level 26

@FreelanceReinh wrote:

Hello Paige,

 

For me it works if I use the "(*ESC*)" notation instead of the ODS ESCAPECHAR in the PROC FORMAT step

 

value weightf 0-59='<60'  60-high="(*ESC*){Unicode '2265'x}60";

(as @Ksharp did three days ago in another thread -- credit to him).

 


This works! Thanks!

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 10 replies
  • 2980 views
  • 5 likes
  • 4 in conversation