No announcement yet.

import file superlab in spss

  • Filter
  • Time
  • Show
Clear All
new posts

  • import file superlab in spss

    Hi, I'd like to know how to import a superlab output file in spss . The superlab output file provides a tab in which on the raws you have the stimula and on the columns you have several indicators (e.g. reaction time).

    I need to have on the raw all the reaction times of a single subject. Can someone help me please ?

  • #2
    Use the free DataViewer to transpose output for SPSS

    If I understand correctly, then you would like to take a data file that looks like this:


    and turn it into a data file that looks like this:


    Is that correct?

    If so, then here are the steps that will allow you to achieve that goal:

    "New Instructions" (for DataViewer 2.0):

    1. Get the free download of DataViewer 2.0 (Mac version or Windows version) from the following web page:


    2. Open your output file(s) in the DataViewer.

    3. Click "Merge Selected Files..." (Or, alternatively, you may select "File >> Merge Selected Files" from the main menu bar of the application).

    4. A dialog window will pop up with the title "Merge Options."

    5. Put a checkmark in the box for the option "Transpose rows and columns in the merged file."

    6. Now click "Merge..." on the pop up dialog.

    7. You will be given a chance to specify where the transposed output will be saved. Specify where to save the output and then click "Save."

    "Old Instructions" (for DataViewer 1.0):

    1. Get the free download of DataViewer 1.0 (Mac version or Windows version) from the following web page:

    2. Open your output file in the DataViewer.

    3. From the main menu of the DataViewer application, go to "Data >> Transpose Output." You should then see in the status bar the message "Data will be transposed in merged output file."

    4. Now click "Merge Selected Files." The file that you save will contain your data in the "sideways," transposed layout that you are seeking.
    Last edited by Kelly; September 12th, 2008, 02:17 PM.


    • #3
      Thanks so much for your reply but unfortunately I still have problems.
      I need to have for each participant on the same raw his/her reaction time for each stimulus and the key (X or N) participants pressed for each stimulus presented but I can't do it. I've tried lots of efforts but without any results. I really hope I don't have to insert all the keys manually. Could you help me if I send you the output? Thanks so much!


      • #4
        by default, the reaction time would be on the same row as the key pressed.

        It would help to see an example of your input and an example of how you would like to see the input organized.
        Last edited by Hank; June 5th, 2008, 12:55 PM. Reason: double-post


        • #5
          I'm sending an excel file where there are two examples:
          firstly an example of how the output appears and secondly an example of how we would like the output appeared. Thanks so much!!
          Attached Files


          • #6
            It seems to me that what you need is the use of Pivot Tables.


            According to what I just read on wikipedia, Calc apparently provides this type of functionality. OpenOffice Calc is a free download from Sun Microsystems.

            It is tricky to get pivot tables working correctly. I am not familiar with the availability or the quality of any OpenOffice documentation on the subject.


            • #7
              shell script

              This kind of data manipulation is pretty easy using unix-style command line tools. The following uses some utilities that you probably won't have easy access to, but perhaps it would be worthwhile as a general example. I copied your example datafile into the paste buffer, and then ran this command:

              pbpaste | tab2dm | tail +7 | dm s2 s5 s11 s5 s10 | scrunch -u 4 | tr "_ " " \t"

              It produced: subject 1 stimulus1 (15, paura) 3749 stimulus1 (15, paura) C subject 1 stimulus1 (10, loculo) 4221 stimulus1 (10, loculo) C subject 1 stimulus1 (6, rocatrice) 4203 stimulus1 (6, rocatrice) subject 1 stimulus1 (27, prontesso) 4032 stimulus1 (27, prontesso) C

              pbpaste: write contents of paste buffer standard output. normally, you wouldn't do this, you'd read from a file instead.

              tab2dm: program I wrote to convert spaces to underscores and tabs to spaces (this format is much easier to script than the tab-delimited format with internal space characters in the SL datafile). reads from standard input, writes to standard output

              tail +7: skip the first 6 lines from standard input and copy the rest to standard output

              dm s2 s5 s11 s5 s10: select certain space-delimited columns from standard input and write them to standard output. this is an utillity called Data Manipulator written by Gary Perlman as part of the old UNIX|Stat package. The column numbers correspond to the columns in the SL datafile that you wanted

              scrunch -u 4: a utility I wrote to join successive lines from standard input together to standard output, in this case, four lines without repetitions

              tr "_ " " \t": put back the spaces and tabs (if there were any underscores in the orginal file, this will turn them incorrectly into spaces). personally, I'd omit this step and stay with the underscores.

              There are plenty of other ways to do the equivalent and to extend it as needed with fairly simple scripts.

              Greg Shenaut


              • #8

                Instead of going through the effort of writing tab2dm, you could have also inserted the following:

                sed 's/ /_/g' | sed 's/\t/ /g'

                that would be:

                sed: swap space with underscore globally

                sed: swap tab with space globally

                I just thought you might like to know. Behold the power of sed.



                • #9
                  Thanks very much for your reply!
                  I don't know how to use unix-style command line tools. It''s very difficult to understand it. I don't know the programming language and this seems to be a big problem if I want to follow your suggestions. Could you help me again and suggest me something easier? Thanks a lot!


                  • #10
                    Hank, yes, of course sed can be used. The tab2dm program also has a couple other bells and whistles (it can skip lines at the beginning and also sticks an underscore into "empty" columns so the column numbering doesn't get messed up for programs that want "space-delimited" lines of input. I used to use various combinations of sed, tail, and tr for this kind of thing, but once I started using SL to gather data, I decided that that was too much pain so I wrote tab2dm. I've attached it here as a .txt file.

                    SInce we're on this subject, I'm also attaching a Korn shell script I wrote for a recent experiment that uses tab2dm. I think it's illustrative of the kinds of techniques and kludges that are needed for this kind of thing with real data. This was data from a lexical decision, semantic priming experiment with three kinds of prime-target relations. There were 10 SOAs and 40 subjects were run at each one (whew!). It was the first real experiment we completed with SL. The script is "good enough" for present purposes, but one of the not-satisfactory parts was selecting a given SL datafile column. In the cvtsl4 script, I did this by inspecting the actual datafiles and using column numbers.

                    Next time, I'll probably use something like the third script I've attached (sl4hdr), which uses the column labels in lines 5 and 6 to assign the column numbers to variables, and also copies the subject ID, scenario name, and the run data and time into variables for later use. I wrote this script as a sort of "proof of concept", I've never actually used it on anything.

                    This is probably way too much detail, but maybe it will inspire someone.

                    Attached Files


                    • #11
                      giuspac, I apologize for not having a scriptless solution for you. You could use a spreadsheet instead of the command line, but I think you'd still have to write some kind of script involving spreadsheet expressions or visual basic.