BookmarkSubscribeRSS Feed
mmccarver
Calcite | Level 5

I am working with a 3rd party vendor who is requesting data sets in a SAS .XPT file. I am a web developer using C# and I have no experience with SAS. 

 

Is it possible to create a .XPT file from scratch using a text writer?

 

 

10 REPLIES 10
ballardw
Super User

I would assume that you have access to SAS in some form. Use of Proc Cport would be every so much easier.

You can either export all of the data sets in a library in to a single file

proc cport data=sashelp.class file='c:\folder\class.xpt';

run;

would create a transport file for the data set sashelp.class.

You can export all of the datasets in a library also

 

proc cport library=libname file='c:\folder\library.xpt' memtype=data;

run;

mmccarver
Calcite | Level 5

Thank you for responding. 

 

I have no access to SAS. To be honest, this is the first time I've ever had to work with it. Typically, clients ask for CSV files as a method of data transferring but they are asking for .XPT files. 

 

Could I even create a .XPT file without SAS? 

 

 

data_null__
Jade | Level 19

@mmccarver wrote:

Thank you for responding. 

 

I have no access to SAS. To be honest, this is the first time I've ever had to work with it. Typically, clients ask for CSV files as a method of data transferring but they are asking for .XPT files. 

 

Could I even create a .XPT file without SAS? 

 

 


Yes you can create a file using a language other than SAS, that can be read by SAS with the SAS XPORT engine.  I believe this link will get you headed in the right direction.

 

http://support.sas.com/documentation/cdl/en/movefile/69975/HTML/default/viewer.htm#p0ld1i106e1xm7n16...

 

If you don't have SAS I'm not sure how you can test it, perhaps post it here and someone can try to read it for you.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

SAS V5 transport file format is open source.  For instance this doc might help:

https://support.sas.com/techsup/technote/ts140.pdf

 

That being said, XPts are old, and a real pain.  They are alos quite limited - variable label length and such like.

mmccarver
Calcite | Level 5

Thank you for your help. I think we are going to try to purchase a tool that can convert a .CSV file to a .XPT file. Could someone point me in the right direction? Learning SAS is outside the scope of what we develop.

 

The client wants

  • SAS Transport V6

 

With file extension .XPT

 

I would like to avoid the purchasing of something we don't need. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I don't know of any tool to do that.  Its should be relatively straight forward to write directly out as XPT though, the file format is well described:

http://support.sas.com/documentation/cdl/en/movefile/69975/HTML/default/viewer.htm#p0ld1i106e1xm7n16...

Even give you some class information to get started.

The one above is v8, but you can also find v6:

http://support.sas.com/kb/46/944.html

TS140 in the above doc.

wait1ess
Calcite | Level 5

Is V8 open-source?

data_null__
Jade | Level 19

@mmccarver wrote:

Thank you for your help. I think we are going to try to purchase a tool that can convert a .CSV file to a .XPT file. Could someone point me in the right direction? Learning SAS is outside the scope of what we develop.

 

The client wants

  • SAS Transport V6

 

With file extension .XPT

 

I would like to avoid the purchasing of something we don't need. 


 

I think this may work

http://www.stattransfer.com/

 

you can download a free trial.

Tom
Super User Tom
Super User

Since this old thread has been re-animated there are a number of packages for creating SAS transport file.

There is the READSTAT package that is written in C.  There are wrappers for call this in the HAVEN package for R.

There is a nice sas7bdat package for R.

Similarly there are packages for Python.

zenenceladus
Fluorite | Level 6

To be honest if you do not want to lose your client find someone in academia or on FIVERR that is a SAS programmer and let them do it. SAS is a required format by the FDA and other regulatory agencies so fooling around with open-source programs of workarounds is probably a big mistake.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 10 replies
  • 7493 views
  • 1 like
  • 7 in conversation