Desktop productivity for business analysts and programmers

Problem with special character [ODBC import SQL Server]

Accepted Solution Solved
Reply
Senior User
Posts: 1
Accepted Solution

Problem with special character [ODBC import SQL Server]

[ Edited ]

Hello everybody.

I need to import a SQL Server table in SAS. I've done this import with an ODBC connector, but in SQL Server table, there are rows with special characters, like ç, á, é, í...

When I've imported this table to SAS, all the values with special char have changed. For example the value ÍNDIO was changed for ¿NDIO.

 

How do I solve this problem with special character?

Are there any people with the same problem?

 

Import code is like this.

 

proc sql;
connect to odbc as mycon
   (datasrc=ora7 user=testuser password=testpass);

create table SAS_TABLE as
select *   from connection to mycon
      (select *  from sasdemo.employees);

disconnect from mycon;
quit;

 

 

Thank you so much.

Best regards,


Accepted Solutions
Solution
3 weeks ago
Occasional Contributor
Posts: 17

Re: Problem with special character [ODBC import SQL Server]

Posted in reply to Mozart_Sindeaux

Hi,

 

which encode configuration you are using in your SqlServer database?

 

It seems to me that you have encoding problem. Maybe this link can help you: http://support.sas.com/kb/36/652.html

 

To understand more about encoding: 

 

https://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Edmonton-User-Group/SAS9UTF-8...

 

 

View solution in original post


All Replies
Solution
3 weeks ago
Occasional Contributor
Posts: 17

Re: Problem with special character [ODBC import SQL Server]

Posted in reply to Mozart_Sindeaux

Hi,

 

which encode configuration you are using in your SqlServer database?

 

It seems to me that you have encoding problem. Maybe this link can help you: http://support.sas.com/kb/36/652.html

 

To understand more about encoding: 

 

https://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Edmonton-User-Group/SAS9UTF-8...

 

 

Trusted Advisor
Posts: 1,756

Re: Problem with special character [ODBC import SQL Server]

Posted in reply to Mozart_Sindeaux

Hello @Mozart_Sindeaux,

 

I concur with @thiagoglima, the link provided should be able to help you.

 

You need to focus on: the encoding (specially if single-byte or double-byte) from origin data source (MSQL) and destination (the SAS table, bases in your SAS sessions encoding, which you can check with %put _ALL_;

 

Then, you need to use the transcoding.

 

Indeed, problem is that SAS-ODBC connections have trouble with trans-coding but the referred SAS note 36652 provides a great example to workaround it.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 135 views
  • 3 likes
  • 3 in conversation