BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pietinma
Fluorite | Level 6

Hi,

I want to do sql query to Oracle database from a SAS session. While we are in Finland there are Scandinavian characters (ä,ö,å) in the database. When I do sql query in SAS I get ä as a, ö as o and å as ?.  What should I do that scandinavian characters displayed right in SAS?

 

This is encoding in my SAS session.

proc options option=encoding; run;

ENCODING=WLATIN1  Specifies the default character-set encoding for the SAS session.

In SAS Oracle sql query result

ä is a

ö is o

å is ?

 

This is encoding in Oracle.

select * from nls_database_parameters where parameter ='NLS_CHARACTERSET';

NLS_CHARACTERSET  WE8ISO8859P15

In Oracle query

ä is ä

ö is ö

å is å

 

Regards

Markku Pietinen

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
pietinma
Fluorite | Level 6

Thank you for your reply,

 

This libname statement solved the problem:

libname o oracle user=&user pw=&pw path=k2000te dbprompt=no encoding ='wlatin1';

 

Why does SAS not read it from the configuration file

 

proc options option=config;

run;

 

CONFIG=( "C:\PROGRA~1\SASHome\SASFOU~1\9.4\sasv9.cfg" "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg" )

                   Specifies the configuration file that is used when initializing or overriding the values of SAS system options.

.....

-SET SASCFG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en"

-LOCALE fi_FI

-ENCODING wlatin1

-TEXTURELOC !SASROOT\common\textures

...

 

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager

Whenever possible, I recommend using ENCODING=UTF8 in SAS. It's a startup option so it must be added to the SAS start command or to the config file. SAS provides a config file for this in ../nls/u8 in the SAS application folder.  Example on Windows:

 

-config "C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg"

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
pietinma
Fluorite | Level 6

Thank you for your reply,

 

This libname statement solved the problem:

libname o oracle user=&user pw=&pw path=k2000te dbprompt=no encoding ='wlatin1';

 

Why does SAS not read it from the configuration file

 

proc options option=config;

run;

 

CONFIG=( "C:\PROGRA~1\SASHome\SASFOU~1\9.4\sasv9.cfg" "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg" )

                   Specifies the configuration file that is used when initializing or overriding the values of SAS system options.

.....

-SET SASCFG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en"

-LOCALE fi_FI

-ENCODING wlatin1

-TEXTURELOC !SASROOT\common\textures

...

 

ChrisHemedinger
Community Manager

Glad you got it working. The SAS session encoding might not pass through to the database automatically depending on how your Oracle client is configured or the settings on the database itself. Good to have that encoding= hook for the libname statement.

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1828 views
  • 1 like
  • 2 in conversation