BookmarkSubscribeRSS Feed
Calcite | Level 5

I was able to import my CSV file into SAS (under lib WORK.nameoffile)


However, I am having issues with created a sas transport file (.xpt).  I have SAS 9.4.  I tried creating with the wizard, and though I can import by in with the wizard, the file is unable to be imported into JMP of SAS viewer. 


I also used the proc copy code below, but am unable to get it to work. 

libname source 'Work.ImportedFile';
libname xportout xport 'C:\ADA\Filename.xpt';
proc copy in=source out=xportout memtype=data; 

I've gotten the following errors - source could not be assigned because libref does not exist. 


Can someone point me in the right direction?


Thank you!





Your first libname statement is wrong ... if you want to access datasets in WORK you just write work.DatasetName.


You should have a look at, especially the comment posted by @RW9

Super User
libname source 'Work.ImportedFile';

the second argument of a libname statement (if no engine designator is used) has to be a physical path name; using a two-level (library.dataset) dataset name can't work.

To export a single dataset, do

libname xportout xport 'C:\ADA\Filename.xpt';
data xport.nameoffile;
set work.nameoffile;

But, given the limits of XPT, I'd rather do

proc cport
Diamond | Level 26 RW9
Diamond | Level 26

Really, the software JMP (or SAS Viewer - I think these are two different applications) only accepts XPT files?  If so delete it from your system.  XPT is a dreadful old file format.  I really do think you should be able to import CSV, or plain dataset into most software nowadays.

Calcite | Level 5
Sadly I need to convert to .xpt. I have heard from many people that they prefer not to work with it, but there are instances where it's still requested.
Super User

And if you simply want to import data into a non-SAS application, use csv or any other textual format (fixed columns, tab-separated, etc) for that. No need to make that extra detour through the Universal Viewer (which, in fact, does not support the CPORT format. Dreadful).

Calcite | Level 5

I have no choice but to convert to .xpt as that is what is required. For some reason they have said not to use cport. 



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4 in conversation