SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Dawn_Edgerton
Calcite | Level 5

Hi all,

I have several SAS datasets I need to convert to XPT files.   

 

The files are currently SAS7BDAT files.  Example: adae.sas7bdat

 

The files were originally created in Japanese.

 

I using the following code to create the XPT files but not having success.

 

libname insas "~,,,\data";
libname sasxpt "~...\sas xpt";

proc copy in=insas out=sasxpt;
select adae;
run;
 
The log notes this:
NOTE: Copying INSAS.ADAE to SASXPT.ADAE (memtype=DATA).
NOTE: Data file INSAS.ADAE.DATA is in a format that is native to another host, or the file encoding does not match the session
      encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
      performance.
NOTE: Data file SASXPT.ADAE.DATA is in a format that is native to another host, or the file encoding does not match the session
      encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
      performance.
ERROR: Unable to transcode character data, such as a name or label, for the file header of SASXPT.ADAE.DATA. Either the data
       contains characters that are not representable in the new encoding or truncation occurred during transcoding.
ERROR: File SASXPT.ADAE.DATA has not been saved because copy could not be completed.
NOTE: Statements not processed because of errors noted above.
 
Any ideas?
 
 
5 REPLIES 5
error_prone
Barite | Level 11
Could be a problem caused by using non-standard names in insas.adae. Can you post the result of proc contents?
ChrisNZ
Tourmaline | Level 20

You need to use proc cport  or libname XPTLIB xport "&path";

 

Dawn_Edgerton
Calcite | Level 5
Thanks for your help. I am now trying Proc CPORT. Here is my code and error messages from the log. The source SAS file contains Japanese text. Could this be the problem?



libname insas "~...\SAS Data";


filename tranfile "~....\adae.xpt";
proc cport data=insas.adae file=tranfile;

run;


NOTE: Data file INSAS.ADAE.DATA is in a format that is native to another host, or the file encoding does not match the session
encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
performance.

NOTE: PROC CPORT begins to transport data set INSAS.ADAE
ERROR: Some character data was lost during transcoding in the dataset INSAS.ADAE. Either the data contains characters that are not
representable in the new encoding or truncation occurred during transcoding.

NOTE: The SAS System stopped processing this step because of errors.




ChrisNZ
Tourmaline | Level 20

The message states that the encoding used to create the files should match the SAS session encoding, or the session can't properly recognise some characters.

 

Run this to see your session encoding:

 proc options group=languagecontrol; run;

 

If you won't or can't change the session encoding, you could try using the INENCODING= and OUTENCODING= libname options to copy these files while respecting their encoding.  

I am unsure this would work.

 

Another pointer: Asian languages might require the CVS libname read engine when being used in a latin encoding session. I am also unsure as I never had to deal with Asian languages.

 

Tom
Super User Tom
Super User

Do SAS XPORT format files support UTF8?  DBCS?

 

But your main problem is you need to set your SAS session in a mode that can READ the SAS dataset.  

I would start by making sure you are running using Unicode support.

If you can't get that to work try running SAS using DBCS.

 

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 5 replies
  • 3065 views
  • 0 likes
  • 4 in conversation