Export data into SPSS in EDC/CDMS
If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.
Table of Contents
Export data into SPSS
To export your Castor data into SPSS you will need to follow a few steps, please see below:
- Create an export file.
- When you want to export this file to SPSS, choose the option: SPSS Export file.
- Click "Export". The export file is now saved on your computer in a default download folder named: studyname_spss_export_datecode.
- It is advisable to move this file to an easily accessible but secure file location.
- The file you have exported is a zip-file (a compressed file) containing several .dat and .sps files. Before you can import these files into SPSS you have to unzip all the files (using "unzip" or "extract").
- During the unzip process you will be asked to specify a location to save the files. This location is used later to import the files in SPSS, so make sure that they are easy to find.
From this folder containing the unzipped files you start importing the data to SPSS.
- Open the syntax file (the .sps file) in SPSS. The syntax file of the study data has the format: Studyname_syntax.sps. The repeating data/surveys have the format: Studyname_repeatingdataname_syntax.sps and Studyname_surveyname_syntax.sps
- In the syntax file the data path of your just saved data should be visible. This has to be visible in the fourth row in the following format: /FILE='Your_study_name.dat'
- This is how it looks when you have opened the file in SPSS:
- Make sure your file path is correct. Open the folder in which the .dat file is stored. In Windows, right click on the file and click 'Properties'. The file path is listed next to 'Location'. In Mac, select the file, then press Command + i. The file path is listed next to 'Where'.
- If you are using SPSS version 21 or higher you should remove the following line: /QUALIFIER=’”’.
- Select the whole file with ctrl+a and run this using the play button in SPSS. The file is now being imported in SPSS (this may take a while).
SPSS Export troubleshooting
If for some reason the above steps don't work you can try the troubleshooting below to try resolve this:
Check the data file path
This is the most common cause for errors. So we strongly advise to check the data path of the file .dat.
Check the dataset on the "Active" dropdown
Another way to resolve issues on SPSS exports is by verifying the selected "active" dataset (the right option in the screenshot below):
We suggest to open a new, unnamed dataset and select the ‘unnamed’ dataset instead of dataset 1 or any other named dataset on the "Active" dropdown.
SPSS files have a variable limit length of 64 characters. It is worth checking if any of your variables is bigger than this.
Export in a wide format and merging data files
Repeating data and survey data are exported in a long format, meaning that every instance is shown on a new row. See here how you can restructure your repeating data and survey data into a wide format and how you can merge your study data with your repeating data or survey data.
Export to SPSS when using a Mac computer
When exporting Castor data to SPSS on a Mac its a bit trickier to put the directory of your data in the .sps file.
After you extracted your export file (the ZIP file) you get a directory containing at least 1 set of .dat and .sps files (data + syntax). You then have to rightclick 1 of them and select "get info". You will see this popup:
After this rightclick the last part after "Where:" (the part that ends with _20151102035054 in the image), you can copy the directory name. You can now paste this in the syntax in the location where the data path has to be. In this case that would be:
The bold part is the part pasted in. If you then run the syntax using the play button the data should be imported.
My calculation fields are empty
If the value of your calculation fields is a text (string), then change the syntax of your .sps file, so that SPSS knows that the calculation field is a text.
For example, you will see:
/VARIABLES= calculationfieldname F10.0
Change this into:
/VARIABLES= calculationfieldname A15
My numbers with decimals are not shown properly
If you use numbers with decimals, then the default decimal separator in Castor is a period (.), while it can be a comma in your SPSS. To change this, add the following line in the third line of the syntax in your .sps file:
SET DECIMALS = dot.
I get the error message "File not found".
SPSS cannot find the data file. There are several explanations:
- The file is still zipped. Make sure that the file is unzipped/extracted.
- The file path is incorrect. Please check the file path in the syntax.
- The file is in a place that SPSS cannot find, e.g. a digital/remote workspace or cloud. Make sure this is not the case. For example, try saving the data file on Desktop or in the same folder as your SPSS and change the file path in the syntax accordingly.
- For Mac users: The file is in a place that SPSS cannot find, e.g. Documents, Downloads, Desktop, or connected external disks. See also this SPSS article. Make sure this is not the case. For example, try saving the data file on in the same folder as your SPSS and change the file path in the syntax accordingly.
My data does not match up with my variable names.
It is possible that your visit/form/repeating data/survey (package) name includes a semicolon (;). Since the delimiter is a semicolon, SPSS will see the name as two values, causing your data to shift one column. You can solve this by deleting the semicolon from your visit/form/repeating data/survey (package) name in Castor and replace it with a different character.
I get the error message "Duplicate variable name (only first 64 characters are counted)".
SPSS only allows variable names up to 64 characters. This error message indicates that your variable names are too long and that SPSS views them as duplicates.
For example, your variable names in Castor could be:
In SPSS, the variables will be the same, which is not allowed:
You can fix this by shortening the variable name in Castor. If this is not possible, you will need to manually replace the variable names in the syntax at '/VARIABLES', 'VARIABLE LABELS', and 'MISSING LABELS':