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!
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
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;
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.
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).
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.