BookmarkSubscribeRSS Feed
sn_1
Calcite | Level 5

Hello,

 

Can you please suggest if there is a way to convert UTF-8 encoded XPT file into SAS dataset in WLATIN1 SAS 9.4 environment. I have tried many options like ENCODING=ANY . But nothing worked. I encountered below log issue.

 

sn_1_0-1714506947595.png

 

I understand UTF-8 is a  MBCS where as WALTIN1 is Single Byte Character Set (SBCS). I understand we can change the configuration to UTF-8 to use MBCS data. But is there a way to do this without changing the environment of SAS to read into file.

 

Thank you much!

Swathi

3 REPLIES 3
Ksharp
Super User
You could use UNICODE sas to import this kind of XPT , after that just convert this dataset from utf-8 encoding into WALTIN1 encoding by this URL:

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/p1g1d26os4w0von1cdfh827foo3r.htm
Tom
Super User Tom
Super User

It matters a lot what type of file your "XPT" file is.  The XPT extension has no fixed definition.  SAS can create V5 XPORT files using the XPORT libref engine.  It can make CPORT files using PROC CPORT.  You can even now make a modified/enhanced version of the XPORT file format that supports V7/V8/V9 enhancements to the SAS dataset by using the SAS supplied %LOC2XPT() macro.

 

So what type of file do you have?  If you don't know you can use this macro to test your file:

https://github.com/sasutils/macros/blob/master/xpttype.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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 917 views
  • 0 likes
  • 3 in conversation