I have a general question. I tried to import Excel file into SAS dataset. There are some special characters, e.g. Ōki. How to keep those special characters (not sure if they are called non ASCII or not)?
I tried to use proc import. The char is just missing e.g. Ōki in Excel, but only shows "ki" in SAS dataset. I also tried to use libname pcfiles to load the Excel file into SAS dataset. But the special char was replaced by "?". e.g. Ōki in Excel, but shows "?ki" in SAS dataset.
@sasecn wrote:
Thanks for the replay. I checked that my encoding is not set to UTF8. Then, how to set to UTF8? I tried to search some solutions, just don't know how to do it. e.g.
- at SAS invocation add the option, –encoding utf-8
- add the system option to the SAS configuration file, ENCODING=UTF-8,
You have to set the encoding option before SAS starts. So you need to change how you start SAS.
The fastest way to get an answer is to ask your local SAS support team how they have configured SAS for you to use with utf-8. If they have not done it yet they can open a support ticket with SAS to get some help.
How do you access SAS? What operating system is SAS running on.
Some examples:
If you have SAS installed on your PC then in addition to the normal app to start SAS with English support you should have one to start SAS with Unicode support.
If you just type sas (or some other unix command) to launch SAS then you might be able use the command line switch. But perhaps instead you need to use the -config switch to point to a different config file
If you are using SAS/Studio or Enterprise Guide to connect to a SAS application server then your will need to connect to a different application server that is configured to use encoding=utf-8. If your organization does not have one they should create one.
Run this to confirm the encoding of your SAS session:
proc options option = encoding;
run;
Typically you need to set your session encoding to UTF8 to handle special characters.
Thanks for the replay. I checked that my encoding is not set to UTF8. Then, how to set to UTF8? I tried to search some solutions, just don't know how to do it. e.g.
@sasecn wrote:
Thanks for the replay. I checked that my encoding is not set to UTF8. Then, how to set to UTF8? I tried to search some solutions, just don't know how to do it. e.g.
- at SAS invocation add the option, –encoding utf-8
- add the system option to the SAS configuration file, ENCODING=UTF-8,
You have to set the encoding option before SAS starts. So you need to change how you start SAS.
The fastest way to get an answer is to ask your local SAS support team how they have configured SAS for you to use with utf-8. If they have not done it yet they can open a support ticket with SAS to get some help.
How do you access SAS? What operating system is SAS running on.
Some examples:
If you have SAS installed on your PC then in addition to the normal app to start SAS with English support you should have one to start SAS with Unicode support.
If you just type sas (or some other unix command) to launch SAS then you might be able use the command line switch. But perhaps instead you need to use the -config switch to point to a different config file
If you are using SAS/Studio or Enterprise Guide to connect to a SAS application server then your will need to connect to a different application server that is configured to use encoding=utf-8. If your organization does not have one they should create one.
Thanks for the explanation. I am using EG, will talk to the IT in my company.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.