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
Opal | Level 21

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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 548 views
  • 3 likes
  • 3 in conversation