ARCHIVED: On Quarry at IU, how to I use Stat/Transfer to convert multiple SAS data sets into SPSS and Stata?
Note: After seven years of production service, Indiana University's Quarry research computing cluster was decommissioned January 30, 2015. IU students, faculty, and staff can request accounts on Karst, IU's newest high-throughput computing cluster; for instructions, see ARCHIVED: Requesting an account. User data on Quarry has not be removed; you can access your old home directory data on Quarry from your account on any other IU research computing resource (see Available access to allocated and short-term storage capacity on IU's research systems). All software modules that were available on Quarry are available on Karst. If you have questions or concerns about Quarry's retirement, or need help, contact the High Performance Systems group.
At Indiana University, Stat/Transfer is available on the Quarry cluster.
To use Stat/Transfer on Quarry, add it to your user environment by loading the Stat/Transfer module:
module load stattransfer
You can use Stat/Transfer to convert data from one format to another:
- To convert an SAS data set (
a1.sas7bdat
) into an SPSS file (a1.sav
), enter:username@q0142: ~> st a1.sas7bdat a1.sav
- To convert the same SAS data set into a Stata file
(
a1.dta
), enter:username@q0142: ~> st a1.sas7bdat a1.dta
To convert multiple files to other formats, use a shell script:
- Create a script file (e.g.,
multiples
) usingnano
, the default editor on Quarry. At the command prompt, enter:username@q0142: ~> nano multiples
- To convert, for example, the SAS data sets
a1.sas7bdat
througha5.sas7bdat
into SPSS (a1.sav
througha5.sav
) and Stata (a1.dta
througha5.dta
) data sets, add these lines to your script file:#!/bin/bash st a1.sas7bdat a1.sav st a2.sas7bdat a2.sav st a3.sas7bdat a3.sav st a4.sas7bdat a4.sav st a5.sas7bdat a5.sav for ((i=1; i<=5; i++)) do st 'a'$i'.sas7bdat' 'a'$i'.dta' done
Note: In this example, the input and output files are in the same working directory.
- To save your file and exit
nano
, pressCtrl-x
, theny
, and thenEnter
orReturn
. - To set the permissions for the
multiples
script, enter:username@q0142: ~> chmod 500 multiples
- To run the
multiples
script, enter:username@q0142: ~> ./multiples
You should find the converted SPSS (
a1.sav
througha5.sav
) and Stata (a1.dta
througha5.dta
) data sets in the working directory.
If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.
This is document azcf in the Knowledge Base.
Last modified on 2023-05-09 14:42:50.