Importing XPT and XPF Xport files into Stata (from SAS)

511 views
Skip to first unread message

Manuel Cicca

unread,
Dec 11, 2013, 5:55:06 AM12/11/13
to stata-us...@googlegroups.com
Hello,
 
I'm trying to convert SAS datasets into Stata (without losing value labels or formats..) by going through the Xport files route.
Hopefully somebody has dealt with this before.
 
I have a dataset in SAS with formatted values (otherwise called labelled values in Stata).
I export that to an XPT file . Stata reads the file without the formatted values with the command
 
 fdause "c:\file_location\file.xpt"
 
In order to make Stata importing the formats the following 2 steps are necessary:
 
1)Output the SAS format catalogue to a dataset
2)Export that dataset in XPF format to formats.xps
 
That way Stata while importing the XPT file containing the actual data looks for the XPF file and imports the label values from it
 
My problem is that I get the following error message in stata while doing that:
 
R:\Technical\SAS\SAS_to_STATA\formats.xpf is not a valid value label file
r(610);
 
Anybody has encountered this issue??
 
Thank you
 
 

J

unread,
Dec 11, 2013, 11:53:11 AM12/11/13
to stata-us...@googlegroups.com
Although I've never used Xport files, I can recommend using StatTransfer for this type of thing. It is very effective and easy to use. 
Reply all
Reply to author
Forward
0 new messages