For SAS and R users
Postgraduate course in
Linear and logistic regression

Edited March 1st, 2010
By Morten Frydenberg


Since version 9.2 SAS can import Stata data sets (*.dta) by the procedure IMPORT
and export to Stata by the procedure EXPORT.

Before version 9.2:
To get the data into SAs you have to download two files: a plain ascii data file ,.dat, and a SAS program, .sas,
that contains format statements and code for reading the data.
Note, the SAS program contains two lines that you have to edit before you run the program.
The first specifies the name and location of the data file:

FILENAME datafile '\\Cronus\www\teaching\postreg\lung.dat' ;

the second specifies the name and location of the library:

libname library '\\cronus\www\teaching\postreg\' ;


Some examples of SAS code that can be used to generate the output in the lectures day 2.


The best way to the data into R is to download the the Stata data set and used "foreign" package, eq