BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jagadishkatam
Amethyst | Level 16

Dear SAS experts,

 

This is with regard to the issue while importing the transport file (.cpt file) by PROC CIMPORT.

 

The Transport file was created in a Windows environment via PROC CPORT and it has the encoding WLATIN1, but I am trying to Import it in UNIX Environment (default encoding=”UTF-8”) using PROC CIMPORT and it is showing the error as in below screenshot.

 

Capture.PNG

 

libname x '~path';
filename y '~pathx';

proc cimport library=x infile=y;
run;
quit;

 

I tried inencoding as well encoding option as well but it did not solve the issue.could you please suggest how i could overcome this error and read the transport file.

 

I am working on sas 9.4

 

 

 

Thanks,
Jag
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Unfortunately you need to start SAS using the wlatin1 encoding instead of the utf-8 encoding to make the PROC CIMPORT code run.

You cannot change the session encoding setting once the session has started.

 

How to do that depends on how you are starting SAS.  If you are running it on PC then perhaps you already have the choice to launch SAS using different encodings in the START menu.  On my PC there is a "SAS 9.4 (English)" icon and a "SAS 9.4 (Unicode)" icon in the start menu that will let me start with the those two different encodings.  Otherwise on Windows or Unix you can start SAS using a different configuration file or command line options to change the system encoding.

 

If you are using Enterprise Guide, or SAS/Studio or some other method that connects to a server to run SAS then you need to have a way to connect to different services that are configured to use the encoding you need.

 

Check with your local SAS support team, or contact SAS support.

View solution in original post

4 REPLIES 4
ballardw
Super User

Please show HOW you attempted to specify encoding.

Shmuel
Garnet | Level 18

To CPORT you probably have a program like:

     filename cpt  '... path and name.cpt';

     proc cport data=...    file=cpt; run;

 

You just need to define the encoding on filename statement:

     filename cpt  '... path and name.cpt'  encoding='UTF-8';

Tom
Super User Tom
Super User

Unfortunately you need to start SAS using the wlatin1 encoding instead of the utf-8 encoding to make the PROC CIMPORT code run.

You cannot change the session encoding setting once the session has started.

 

How to do that depends on how you are starting SAS.  If you are running it on PC then perhaps you already have the choice to launch SAS using different encodings in the START menu.  On my PC there is a "SAS 9.4 (English)" icon and a "SAS 9.4 (Unicode)" icon in the start menu that will let me start with the those two different encodings.  Otherwise on Windows or Unix you can start SAS using a different configuration file or command line options to change the system encoding.

 

If you are using Enterprise Guide, or SAS/Studio or some other method that connects to a server to run SAS then you need to have a way to connect to different services that are configured to use the encoding you need.

 

Check with your local SAS support team, or contact SAS support.

Jagadishkatam
Amethyst | Level 16
Thank you Tom

I started the sas session like below

sas94 -encoding wlatin1

and then in that sas session I executed the proc cimport and it resolved the issue.
Thanks,
Jag

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 4290 views
  • 0 likes
  • 4 in conversation