I am trying to add the character mu(µ) on the column name of my sas7bdat file but it gets recognized as "?".
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.
DO NOT DO THIS.
Funny characters belong in labels, not in variable names. Otherwise you will always be forced to use those silly name literals.
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.
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
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.