BookmarkSubscribeRSS Feed
EinarRoed
Pyrite | Level 9

In DI Studio I have a job which uses a File Writer transformation to write to an External File object, which is CSV. I need the CSV to be encoded in UTF-8.

I had hoped that I could simply set UTF-8 in the encoding option, but that has no apparent effect.

According to this SAS Support page (SAS(R) 9.2 National Language Support (NLS): Reference Guide), DI Studio uses Wlatin1 by default, and UTF-8 must be specified in the outfile statement.

However, in DI Studio the external object only has an INFILE statement, which I suppose is ignored.

Do you have any advice on how I can use DI Studio to write a CSV-file with UTF-8 encoding?

3 REPLIES 3
EinarRoed
Pyrite | Level 9

Is there any way for me to write CSV with UTF-8 encoding? I don't mind if I have to use user written code here. No matter what I try, the external file shows up as ANSI.

The important thing is that Norwegian characters such as æ/ø/å should be displayed with 2 bytes.

LinusH
Tourmaline | Level 20

This is annoying. The External File objects are clearly created for infiles. But they are the only objects that can be used for exporting files as well. Someone should tell SAS this obvious lack of functionality in such a basic object.

having that said, the only way I found is that you can specify this in the File Writer object (File Statement Options). Not perfect (encoding should be an attribute of the file so it will be reused, not the process step that creates it).

Data never sleeps
jakarman
Barite | Level 11

SAS(R) Data Integration Studio 4.5: User's Guide (Specifying NLS Support for External Files)

You could overwrite the generated code as a bypass. Better to use SAS(R) Data Integration Studio 4.5: User's Guide (About User-Written Code). You can define your own transformation.

As your are Norwegian latin1 with wich code-page? ISO/IEC 8859-1 - Wikipedia, the free encyclopedia.

Your installation (server-side) is probably set-up is Norway-latin1. It could haven been setup using utf-8 extended with en/no. The WS-service is the one yuo are seeing with DI. With an installation supporting utf-8 en/no a WS service must be configured to choose one of them. You could however using multiple WS-servers each serving an other language/encoding.

Running a latin1 session will be normally the best choice as most people are expecting that behavior. An utf8 session has some quirks.    

---->-- ja karman --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 2416 views
  • 7 likes
  • 3 in conversation