Help using Base SAS procedures

opening a .xpt file in sas 9.1

Reply
N/A
Posts: 0

opening a .xpt file in sas 9.1

I am trying to run a means procedure on a dataset i found on icpsr.com. The website gave me a dataset that ends with .xpt. I put the file on my desktop and ran this code:

libname sasdata 'C:\Documents and Settings\econ4961\Desktop\04572-0002-Data.xpt';
data one;
run;
proc means;
run;

It doesn't work and it tells me that the dataset has 0 variables. Is there something else I should be doing? Please help, thanks.
Super Contributor
Posts: 273

Re: opening a .xpt file in sas 9.1

Posted in reply to deleted_user
You encounter a sas table stocked in an xport format (xpt is usually the suffix but not always)
so you need a special manner to recreate a normal sas table

try this

[pre]
libname in xport 'C:\04572-0002-Data.xpt';
libname ou v9 "c:\";
proc copy in=in out=ou; select one;run;
*if you are sure that the dataset name is 'one' ,otherwise dont use the
select and read your log to find the table name;
proc means data=ou.one;
run;
[/pre]

Andre
N/A
Posts: 0

Re: opening a .xpt file in sas 9.1

Posted in reply to deleted_user
The following note for Enterprise Guide gives you some code you can use in SAS 9.1 to import the transport file to a library.

http://support.sas.com/kb/16/800.html

You will need to define a library, in the sample code the SASUSER library is used, which may be adequate. To reference the data however, you will need to specify the table. Browse the library, or the log, and you will get a list of table(s) imported for your use.

I am surprised that a website made available a transport file without instructions on its use. I searched the website you specified and couldn't find any assistance there.

Kind regards

David
Ask a Question
Discussion stats
  • 2 replies
  • 5682 views
  • 0 likes
  • 2 in conversation