SAS Viya

SAS Viya’s AI-based automation aligns to the needs and talents of your team, keeping both models and progress in motion across the analytics life cycle.
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
a_SAS_sin
Obsidian | Level 7

Hi

I am on Viya 2024.09  on AKS.

I am connecting to a SQL Server with Collation="SQL_Latin1_General_CP1_CI_AS". 

I am using the following code to connect to extract the database using Compute:

/*COMPUTE - Libname statement*/
libname sqlComp odbc
  complete="driver=SAS ACCESS to MS SQL Server;
    port=1433;
    server=&_SQLSR_SRV.;
    database=&_SQL_DB.;
    stringdates=no;
    read_lock_type=nolock;" 
  schema=&_SQL_SCHEMA. 
  authdomain="&_authDomain."
;

proc sql;
  select TableVersionLabel as Compute_Label
  from sqlComp.TableVersion 
  where TableVID =2328;
quit;

which returns the following:

a_SAS_sin_0-1741100341688.png

To connect CAS to SQL Server and extract data I sue the following:

/* CAS - libname  statement*/
caslib odbccasl 
     datasource=( 
      srctype = "odbc" 
      authenticationDomain = "&_authDomain."
      catalog = "*"
      schema = "&_SQL_SCHEMA."
      conopts="driver=SAS ACCESS to MS SQL Server;
          port=1433;
          server=&_SQLSR_SRV.;
          database=&_SQL_DB.;
          stringdates=no;
          read_lock_type=nolock;" 
    ) ;

/*Loads the data in casuser using fedsql*/
proc fedsql sessref=mySession _method ;
   select a.TableVersionLabel as CAS_Label
   from odbccasl."TableVersion" a  
    Where TableVID =2328;;
quit ;

Which returns the following:

a_SAS_sin_1-1741100479776.png

 

As you can see the "long-dash" character is not shown correctly.
How can I make sure the values in CAS are shown correctly.


FYI, the odbc driver is installed in a mounted share that is used by both the compute and CAS.

Thank you,

1 ACCEPTED SOLUTION

Accepted Solutions
splslb
SAS Employee

I work in SAS Technical Support (TS). As discussed in the TS case:

Firstly I would suggest using the dedicated module SAS/Access to MS SQL Server. In order to use this module you'd need to change your SAS code to use:

srctype=’sqlserver’ in caslib and also sqlsvr engine in libname (instead of odbc)

and then:

- set IANAAppCodePage=106 to reflect utf-8 in Viya,

- column type names in SQL Server are expected to begin with n like nchar, nvarchar.

View solution in original post

2 REPLIES 2
splslb
SAS Employee

I work in SAS Technical Support (TS). As discussed in the TS case:

Firstly I would suggest using the dedicated module SAS/Access to MS SQL Server. In order to use this module you'd need to change your SAS code to use:

srctype=’sqlserver’ in caslib and also sqlsvr engine in libname (instead of odbc)

and then:

- set IANAAppCodePage=106 to reflect utf-8 in Viya,

- column type names in SQL Server are expected to begin with n like nchar, nvarchar.

a_SAS_sin
Obsidian | Level 7
Adding the option `IANAAppCodePage=106` fixed the issue.
Thank you @splslb

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Discussion stats
  • 2 replies
  • 852 views
  • 1 like
  • 2 in conversation