4.9 Importing OpenClinica Data into STATA

Stata is a commonly used tool for statistical analysis. The following describes some methods for bringing OpenClinica datasets into STATA.

Option 1. If all you want is raw data and don't care about the variable labels, coded value lists, etc:
Extract SPSS format, then unzip it to the STATA working directory.

Import the .dat file by typing:

insheet using "SPSS_DAT.dat"

Or put the name of the .dat file in between the "".

Option 2. Similarly to this effect, it is fairly straightforward to convert an SPSS data file (. dat) to Stata (.dta) via Stat/Transfer. But you need to have a license for it.

Option 3. Some folks at the Murdoch Children's Research Institute in Australia have created a helpful utility here which combines the .dat and ..sps syntax file into a STATA-ready file:

http://openclinica.mcri.edu.au/DMTools/OpenClinica/SPSStoStata.aspx

Option 4. You can use this script that does similar work as the mcri.edu.au utility, except works offline and not as thoroughly. It results in a .do file with labels and a STATA .dta dataset with fully labeled variables and coded lists. The script automaticaly detects the required user-defined STATA command. The script and how to use it is documented. It is shared with with permission of the author.

Regardless, if developing a study that will be analyzed in STATA, try to follow naming requirements that will comply with STATA requirements for variable naming. Most common problems are too long variable names and not permitted characters in variable names. If you have such issues, the script in 4 can be modified (hints in the documentation) to overcome these issues at the processing stage.


Approved for publication by Benjamin Baumann (bbaumann), Principal. Signed on 2014-03-24 9:25AM

Not valid unless obtained from the OpenClinica document management system on the day of use.