using python to automate data translation process from eprime to SPSS
Peter Quain
pquain at une.edu.au
Sun Aug 19 00:11:24 UTC 2012
I assume you are concerned with 'extra' variables and think you must
use edataaid to muck about with them (If I've misunderstood your
post, excuse me). At least (this works) in venerable e-prime 1. I
don't know if there have been any changes that break this in
subsequent incarnations ... After each subject's run try opening the
.edat file (double click, of course) then choose 'Save As' from File
menu, choosing 'SPSS or Statview' option. Saves as a tab-del text
document (.txt documant is tab delimited by default). Your SPSS
syntax can pick it up from there no worries. Don't worry about the
extra variables (e.g., random seed) just work out the order of
variables, and which ones you want to keep. Import the tab-del file
using point and click commands and paste the syntax (not run it).
Then you can edit the import syntax to name your important variables
as you want them, and subsequently use 'Keep' and 'Drop' commands to
keep those you want, and to order them as you please in the SPSS .sav
file. Rough example follows (that you could easily include in a
Python (or a WinWrap Basic ... formerly Sax Basic) script):
----- From a previous post -------------------------
We export the entire unmodified edat file to tab del text then import
the whole thing into SPSS, using the point and click read text data
wizard, allowing the program to modify variable names however it
wishes. We save then run the syntax, then print variable names with
the 'Display Labels' command, identify the variables of interest, and
use the 'Keep', 'Rename' and 'Drop' subcommands of the 'Save' command
to sort the columns, and provide meaningful variable names and / or labels.
Once this is done for the 1st subject's data file the syntax can be
run for each subsequent file simply by changing the source file name,
and the outfile names. Any combination of variables can be grabbed
from the master file by a few changes to the keep, drop, and rename
subcommands. Because the variable names are the same in both
individual subject and merged files the syntax can be used to import
and organise single subject data (to combine behavioural data with
EEG files, for instance), or merged files. Some rough example syntax
(minus the display labels command) for single subject data (no
subject identifier included) below:
* Import e-dat info for ENUM3
GET DATA /TYPE = TXT
/FILE = 'C:\AAPete\PhDData\Enum3\E3_5\e3_5_edat.txt'
/DELCASE = LINE
/DELIMITERS = "\t"
/ARRANGEMENT = DELIMITED
/FIRSTCASE = 2
/IMPORTCASE = ALL
/VARIABLES =
Experime A10
Subject F1.0
Session F1.0
Age F2.1
V4 F6.2
Gender A1
Group F1.0
Handed A1
RandomSe F10.2
SessionD A10
SessionT A8
Block F1.0
BlockLis F1.0
V14 F1.0
V15 F1.0
Practice F1.0
V17 F1.0
V18 F1.0
V19 A8
Procedur A9
V20 A17
Trial F2.0
CheckAcc F1.0
V24 F1.0
V25 F1.0
Code F2.0
CollectC F6.0
V28 F4.0
corransw F1.0
Fixation F4.2
V31 F4.2
V32 F2.1
None F2.1
NoWords F1.0
numobs F1.0
PracList F2.1
V37 F1.0
V38 F2.1
V39 A9
Recall.A F1.0
V40 A9
Stim1 A9
ThreeSyl F2.1
ThreeWor F1.0
TrialLis F2.1
V46 F1.0
V47 F2.1
TwoSyl F1.0
TwoWords F1.0
Type F1.0
Word1 A3
.
CACHE.
EXECUTE.
Save Outfile= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat_MASTER.sav' .
Get
file= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat_MASTER.sav' .
Save Outfile= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat.sav' / Keep
block trial checkacc code collectc v28 corransw recall.a stim1.
Get
file= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat.sav' .
Compute ob = $CASENUM.
Execute.
Formats ob (F8.0).
Save Outfile= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat_2.sav' / Keep
ob code corransw checkacc v28 all.
Get
file= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat_2.sav' .
Save Outfile= 'C:\AAPete\PhDData\Enum3\E3_5\E3_5_edat_3.sav' / Rename
(code corransw checkacc v28 = type resp acc rt) / Drop= block To stim1.
At 09:33 AM 19/08/2012, you wrote:
>Hello,
>I am currently struggling with trying to automate my data
>translation process from eprime to SPSS. I am not using emerge
>because I need to create individual spss data files for each of my
>subjects. I have written sytax that automates the translation from
>the edat output (tab-separated) to an SPSS data file but I need to
>figure out a way to circumvent e-dataAid so I can automate the whole
>process and reduce the chance of any errors during the process. I
>was planning on using python so that I could have the user select
>the files that they want to convert to SPSS and then it does it
>automatically. From what I gathered from python help forums is that
>I need to parse the raw data txt document into a tab-separated
>file. Is there a way to do this or documentation how to do this
>somewhere? The workflow would be something like: raw data txt file
>--> tab separated --> spss syntax (it reads from a list file I
>created in spss) --> spss data file. I think the main spot I am
>stuck at is parsing the data from the raw file so I can circumvent
>edataAid. From there it seems like it might be somewhat
>straightforward. Thank you in advance for any help you can
>provide. If you have any tips for the python part of this process
>that would be appreciated as well, but I know the group is for
>e-prime and do not expect help with that.
>Thank you,
>-Kyle
>
>
>--
>You received this message because you are subscribed to the Google
>Groups "E-Prime" group.
>To post to this group, send email to e-prime at googlegroups.com.
>To unsubscribe from this group, send email to
>e-prime+unsubscribe at googlegroups.com.
>To view this discussion on the web visit
><https://groups.google.com/d/msg/e-prime/-/bx6rJBdDAKEJ>https://groups.google.com/d/msg/e-prime/-/bx6rJBdDAKEJ.
>For more options, visit
><https://groups.google.com/groups/opt_out>https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20120819/e8d537db/attachment.htm>
More information about the Eprime
mailing list