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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@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: 

 

  • Using "PC" SAS running on your local Windows machine.
  • Running SAS from the command line on your Unix server.
  • Using Enterprise Guide (a Windows program) to access SAS running on the same Windows machine.
  • Using Enterprise Guide to access SAS running on some other machine
  • Using a browser to connect to SAS/Studio.

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.

 

 

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

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. 

sasecn
Quartz | Level 8

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

 

Tom
Super User Tom
Super User

@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: 

 

  • Using "PC" SAS running on your local Windows machine.
  • Running SAS from the command line on your Unix server.
  • Using Enterprise Guide (a Windows program) to access SAS running on the same Windows machine.
  • Using Enterprise Guide to access SAS running on some other machine
  • Using a browser to connect to SAS/Studio.

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.

 

 

sasecn
Quartz | Level 8

Thanks for the explanation. I am using EG, will talk to the IT in my company.

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
  • 1122 views
  • 3 likes
  • 3 in conversation