Actions

Exporting results

From LimeSurvey Manual

Revision as of 15:56, 18 March 2010 by Mdekker (talk | contribs)

Once your survey is active you can start browsing responses and export them. To get to the survey response overview click...

Browse results.png

Export to application (Excel/.csv)

On top of the browse responses page several export options are listed, beginning with export to CSV/application.

Export2.png

When exporting results to an application there are several filter options which are separated into:

  • General
    • Set a range like export records X to Y
    • Set to export all records OR completed records only OR incomplete records only
  • Questions
    • Set how the heading should look like: Abbreviated heading OR full headings OR question codes
    • Convert spaces in question text to underscores
  • Answers
    • You can either export full answers or convert answer codes Y and N to a defined variable
  • Format
    • Microsoft Word (latin charset)
    • Microsoft Excel (all charsets)
    • CSV File (all charsets)
    • PDF
  • Column Control
    • Set which answers should be exported. All answers in this list are represented by their SGQA identifier
    • Set which token data should be exported. This option is only available if your survey is not anonymous!

Export tokens.png

SPSS Export

(Instructions based on version 1.87)

Export and filter data

When exporting data to SPSS there are two filter options. You can select which data should be selected (all records/completed records only/incompleted records only) and for which SPSS version the export files will be used (prior version 16/16 or up).

SPSS export includes two files:

  1. a syntax file (survey_xxxx_SPSS_syntax_file.sps)
  2. and a data file (survey_xxxx_SPSS_data_file.dat).

After having downloaded these files you can open them using a raw text editor like notepad to take a look how the exported data looks like. The syntax file holds the commands that should be run to import the data. It is like a programming language inside SPSS. The data file contains a comma separated file with all data. If you just import this data as csv via a wizard you loose information about questions, labelsets etc. so we don't do that.

Import data in SPSS

Place the two files in the same folder on your drive (example: c:\data\survey_xxxx_SPSS_syntax_file.sps and c:\data\survey_xxxx_SPSS_data_file.dat)

We have two options now:

1. When using Windows use the explorer to browse to the folder used above. If SPSS is connected to the .sps file extension you can just open the file by double clicking it:

Spss explorer-screenshot.jpg

Now you can just choose Run->All from the opened window and after some time have your output dataset that you can save as a normal .sav file.

2. Sometimes the easy solution above does not work. Then you can proceed as follows:

  • Open SPSS
  • Choose File->Open->Syntax
  • Choose the appropriate file: c:\data\survey_xxxx_SPSS_syntax_file.sps
  • Now the syntax opens.
  • Change the line that reads /FILE='survey_xxxx_SPSS_data_file.dat to include the path where the files are: /FILE='c:\data\survey_xxxx_SPSS_data_file.dat
  • Now choose Run->All and after a while you have the dataset with all info like questions, labels etc.

R Export

Feel free to add more information if you have some!

The freeware software R is an alternative for SPSS. It is closely linked to the SPSS export in LimeSurvey. Instructions on how to import your dataset in R:

  1. Download the data and the syntax file from the browse response screen.
  2. Save both of them on the R working directory (use getwd() and setwd() on the R command window to get and set it).
  3. Enter: source("Surveydata_syntax.R", encoding = "UTF-8") on the R command window

VVExport (File:Exportvv.png) and VVImport (File:Importvv.png)

Once you've begun collecting responses, there may be occasions where you need to be able to directly edit and modify large quantities of data from your responses table, where a spreadsheet tool may be more useful.

VVExport and VVImport (the "VV" stands for vertical verification) allow you to export your responses table into a .xls file. So long as the general structure of the file remains intact, you can then edit values within it, and the import the file again into your responses table using the "VVImport" feature.

Exporting a VV survey file

When you choose to export responses using VVExport you will be given the option of either exporting the results and leaving the survey active, or exporting the results and deactivating the survey.

If you choose to deactivate the survey, the responses table will be renamed and become unavailable without direct MySQL access (it will be renamed in the same way as deactivating a survey does).

If your survey uses tokens you should note that deactivating the survey also causes the tokens table to be renamed and made unavailable. It is probably best not to deactivate a survey that uses tokens unless you know how to rename tables in MySQL and can move the tokens table back manually.

The ability to deactivate the survey is important because a 'vv survey file' allows you to import the responses to a survey when the question/answer combinations have changed. Effectively this allows you to add or remove questions in an active survey.

Clicking on "Export Responses" will then produce a tab delimited file that can be opened by Excel or similar style spreadsheet program. The first two rows of the spreadsheet are the column labels. The first row is a "human readable" column heading that details the name of the question/answer field. The second row is the internal PHP column name for that response.

You should not modify the first two rows of this spreadsheet if you want to be able to "import" the data back into LimeSurvey at a later point.

Importing a VV survey file

As long as the first two lines are intact, you can then import the data in your vv survey file back into an active LimeSurvey survey. If you deactivated the survey when you exported the data you will need to activate the survey in the normal way when doing this.

Then, from the browse screen, choose the "Import a VV Survey file" icon.

The "Import a VV Survey File" screen needs you to choose the "vvexport" you are importing. If you choose to "Exclude Record IDs" the records will be imported and brand new Record ID's will be generated for them. If you un-check this box, then the original record id's will be imported.

There are a range of options you can choose that tell LimeSurvey how to deal with double or multiple entries.

  • Report an error (and skip the new record).
  • Renumber the new record
  • Ignore the new record
  • Replace the existing record

How to use VV-Export and VV-Import:

The VV-Import function is not particularly smart. The spreadsheet being imported has to be massaged into shape so that it matches the new survey.

The idea of VV-Export/VV-Import was to allow import of results from a survey table that had changed. My standard procedure for the VV-Export/Import process is to:

  1. Create the new survey
  2. Activate the new survey
  3. Perform a VV-Export from the _new_ survey (first export)
  4. Perform a VV-Export from the _old_ survey (second export)
  5. Cut the two top rows from the first export and insert them as the top two rows in the second export.
  6. While leaving the first two rows unchanged, cut and paste the columns below so that they are now in the right place according to the first two rows.
  7. Once all the data is in the correct spot, delete the 3rd and 4th row (ie: the headings from the second export)
  8. Save it all as a CSV file
  9. Perform the VV-Import into the _new_ survey

Other export options

Export a single response

If you want to export an individual response, you can do it in 3 ways:

1. Login to limesurvey admin backend, choose your survey, goto "Edit survey settings" -> "Notification and data management" and make sure you receive basic email notifications.

Every time someone has completed a survey, you will receive an email with a link: "Click the following link to see the individual response"

This will take you to a page with a button above the data saying "Export this response"

2. Login to limesurvey admin backend, choose your survey and "Browse responses for this survey". Click on "Display responses" and the id number you want to export in the left column. Then you can click on "Export this survey" above the data.

3. Login to limesurvey admin backend, choose your survey and "Export results to application". In the last field above "Export data" you can choose which entry you want to export.

Match Responses From Different Surveys (longitudinal survey)

If you want to track survey responses for particular individuals over time, Limesurvey can help you do that. A possible use case is to track group responses before and after the group takes a particular seminar.

The steps to implementing this are as follows:

1. Create the survey

2. Make sure the survey is non-anonymous and uses tokens. To create a non-anonymous survey:

a) Click on the edit survey button:

Editsurvey.png

b) Then under the Notification & data management tab select "No" for Anonymous answers:

Make private.png

3. Activate the survey.

When you activate the survey, click on the "switch to closed-access mode" button to create the token table:

Switch to closed.png

4. Populate the tokens table with whatever method you wish (follow the instructions found at the Tokens page ).

5. Export the survey results and make sure you include the token information.

To export click browse results...

Browse results.png

...and then export:

Export2.png

Remember to choose one or more elements from the token table to associate with the survey responses:

Export tokens.png

6. When you run the survey again, which can easily be done by copying the survey and tokens table using export/import, just repeat the steps, and make sure the same query is used to build the csv token import file.

Problems & Solutions

Excel

Modifying responses in Excel prior to Import

In order to make multiple changes to responses, you may choose to Export and open a file in Excel. Make changes to the data (other than the top lines) and then save as a .txt file. If you save as .csv, Excel uses comma-delimits which will not import into LimeSurvey. By saving as a .txt file, Excel saves as a tab-delimited file which imports back into LimeSurvey.

Edit .csv with Excel

In general we do not recommend to use Excel to edit the exported .csv files because Excel does some changes to the internal data structure which results in a failing import. If you nevertheless want to use Excel you have to set the seperator for Excel to a comma in System Control (Windows Systems):

System Control|Region- Languageoptions|Regional Settings, customize...|Tab Numbers|Digit grouping symbol| replace ; with ,

Workaround to edit .csv files with Excel

Using Excel for editing questions can prevent you from being able to re-import them. But editing is the way to go if you have more than 5 or so options or ranking options, want to use Excel capabilities like sorting, etc.

This is a partial workaround that seems to work in 1.82-essentially, only use Excel on the part of the file that is the data:

  • Export a question similar to what you would like to reuse as .csv file
  • Open the CSV file in a rawtext editor
  • Copy the part that has the answers to Excel, and parse it with Text to Columns or equivalent.
  • Use the talent of Excel to allow pasting text in columns to paste in 20, 50, 100 answers, as you wish
  • Save the file as Excel CSV, which will likely have no quotes.
  • Open this file in the editor, and Select All, Copy
  • Go back to the file you opened in 2)
  • Paste over the answers there
  • Save AS, with a different name, maybe one that you can remember for reuse
  • Import this file.

Excel - export limited to 255 columns

Due to limitations in Excel (versions lower and equal to 2003), LS can export only 255 columns at the same time. Microsoft has proposed a workaround as a VB macro.

Although newer spreadsheets (Excel >= 2007, OpenOffice) can display more than 255 columns, the internal module used by LimeSurvey still can't export more than 255 columns.

Two workarounds are however possible, use one of the following solutions:

  • Either export to CSV and import in your spreadsheet
  • Or use multiple exports (selecting at most 250 columns at a time), then merge the exported results

Excel/.csv - export fails

If you are unable to export your data to excel or into a .csv file please try to clear your browser cache and cookies.

SPSS export

SPSS compatibility

Limesurvey's SPSS export is optimized for working with SPSS v16 or later. If you are running older versions and want to open exported data you have to delete "SET UNICODE=ON" from the syntax and then exchange variable formats that don't work with the older version with ones that do.

Working with SPSS before version 16

This section is important only if you need support for special characters. Limesurvey's SPSS export is optimized for working with SPSS v16 which has unicode support. If you are running older versions and want to open exported data you have to convert data and syntax files to a supported encoding. To do this follow the steps listed below:

1. Open both files with a text processor (OpenOffice or MS Word).

2. At startup choose the correct encoding (utf-8) for the document.

3. Save the document with "save as" in the "only text" format.

4. The text processor should prompt you which encoding you would like to use; choose windows standard.

5. Delete the first line in the syntax file (SET UNICODE=ON.).

6. Adjust the path to the data file.

7. Use in SPSS Run/all.

Toggle between complete responses, incomplete responses and both

By default the SPSS export functionality includes both complete (submitted) and incompleted (not submitted) responses. Or any other default value you set in config.php for |$filterout_incomplete_answers. The Display setting on the Display Responses page determines which responses are exported to SPSS.

To include incomplete responses in an SPSS export, first go to Browse Responses ... , then Display Responses, and set Display to Completed records only - and then do the SPSS export. You will now get only the submitted responses.

ERROR. command name:Get Data

If you receive the error message ERROR. command name:Get Data. 2267 Unexpected Token missing. please edit the forth line of your syntax file so it points to the absolute path of the data file like

C:\spss\DatenlimesurveySPSSsurvey_35276_SPSS_data_file.dat

Error: "Text value unmappable in the current server locale"

This error can happen if you try to open an exported syntax file in SPSS 16. The solution is to force SPSS to interpret the syntax file as unicode.

Open SPSS. Go to Edit > Options > Character encoding for data and syntax. Change the option to "unicode".

LimeSurvey data can now be exported to SPSS 16 without any problem.

Define the scale to use for your variable by setting a question attribute

It is possible to override the default scale used for a variable by setting the question attribute #scale_export|scale_export to the appropriate value.

VV Export/Import

VV - Problems with vv import

If you have difficulties importing a vv file, try a Tab-delimited file and it should work fine.

Other problems and solutions

Copying responses into a different survey (using tokens)

  1. Create new survey, add a dummy response, export the response file, open in Excel. This creates the format for the new import file.
  2. Export the responses from the old survey, including tokens, open in Excel.
  3. Use this data to create an Excel worksheet for the standard token file import (eg. Firstname, Lastname, Token, Email address, Email status (OK), Language (En). Save as .csv and import tokens to the new survey in LimeSurvey.
  4. In Excel, copy the response fields from the old survey responses that you want in the new survey (including token) into the appropriate Excel column of the new survey format.
  5. Save as .txt file.
  6. Use VVImport to import the new data into the new survey.
  7. Possible import errors include date format - some system date fields do not allow a NULL value, some do. If the date looks okay but gives an error, use the Excel cell format "2009-12-01!