BookmarkSubscribeRSS Feed
cjoshi
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; 
run;

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!

 

 

 

6 REPLIES 6
andreas_lds
PROC Star

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 https://communities.sas.com/t5/SAS-Programming/Issue-converting-Length-greater-the-230-in-XPT-c/m-p/..., especially the comment posted by @RW9

Kurt_Bremser
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;
run;

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

proc cport
  data=work.nameoffile
  file='C:\ADA\Filename.cpt'
;
run;
RW9
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.

cjoshi
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.
Kurt_Bremser
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).

cjoshi
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. 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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
  • 2616 views
  • 0 likes
  • 4 in conversation