BookmarkSubscribeRSS Feed
didexist0001
Calcite | Level 5

I am trying to add the character mu(µ) on the column name of my sas7bdat file but it gets recognized as "?". 

didexist0001_2-1712042643913.png

didexist0001_1-1712042597202.png

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Better you should put this in a label instead of the variable name. SAS will use the label in the output of almost every PROC.

--
Paige Miller
ballardw
Super User

The question mark indicates that the font used does not recognize how to render the given "text" of the character.

 

It will probably not take you very long writing code to get extremely tired of typing all of the quote and n referencing variable names. Using something like '(a)'n adds 7 key strokes, counting the Shift to get the ( and ) to something that can be expressed with just A.

Define a label one time when creating the variable and you don't have to repeatedly type the '()'n.

 

Plus I know I hate being given code or data that forces me to change my system settings just to run the code or examine the data.

 

 

Tom
Super User Tom
Super User

How are you submitting your SAS code?  Are you use Display Manager?  SAS/Studio? Enterprise Guide?

What system encoding is set in your SAS session?  Check the value of the ENCODING system option.

 

If you paste a literal mu character into the code file then the encoding used by that literal string has to match the encoding your SAS session is using.  And since mu is not one of the 128 standard ASCII characters it might not even be available in the encoding you are using.

 

If you really did need to generate a RENAME statement or a LABEL statement using a character that is not supported by your SAS sessions encoding then you might want to use macro logic to help.  So let's assume you need to generate mu in UTF-8 encoding.  That would be 'CEBC'x.  So you might do something like:

data _null_;
  call symputx('mu','CEBC'x);
run;
data have;
   input myvar ;
   label myvar="(/&mu.L)";
cards;
2
2
0
0
;
proc print data=have label;
run;

Result

Tom_0-1712072048596.png

 

 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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