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"

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2165 views
  • 1 like
  • 2 in conversation