

Instructions for importing *.csv files through the GUI can be found at Reading CSV Files.Ĭommand syntax can also be used to read the data into SPSS Statistics. Loading the data file into SPSS Statisticsīecause the full_data.csv data file is not a native SPSS Statistics file (*.sav), the file must first be imported into the application. The data values presented here might not exactly match data from other sources (for various reasons). Refer to the notes at Coronavirus Disease (COVID-19) – Statistics and Research for details regarding exact dates. The full_data.csv file was downloaded on April 1, 2020, and contains COVID-19 data through the end of March (based on the timelines maintained by the European Centre for Disease Prevention and Control). The data is maintained by Hannah Ritchie, and was downloaded directly from Coronavirus Source Data. This site contains a substantial amount of useful information on data and other aspects of the COVID-19 pandemic. The data for this example is from the full_data.csv file that was obtained from the highly informative Coronavirus Disease (COVID-19) – For information regarding SPSS Statistics command syntax, see Working with Command Syntax. The command syntax provides flexible programming of analyses, the ability to save instructions for the reproduction of future outcomes, and allows for adaptation to new data or problems. SPSS Statistics features an easy-to-use graphical user interface (GUI), but almost all of what the GUI allows you to do is performed behind the scenes by a powerful command syntax language. You should now be able to create a unique ID number for each of your cases in a SPSS data set.You can use IBM SPSS Statistics for various descriptive and predictive analyses of data, such as those generated by the COVID-19 pandemic. Right, that’s it for this quick tutorial. Each case is now associated with a unique identifier. There are a few things you could do to tidy this up – for example, get rid of the decimal point and drag the ID variable over to the left so it appears in the first column – but really this is job done.

The new ID variable contains a unique identifier for each case in the data set. If you press OK, SPSS will generate a variable named ID that will contain a unique identifier for each case in the Data View. The third thing is to drag the $Casenum function into the Numeric Expression box (as per the red arrow above). This will generate a set of unique integers that can function as ID numbers. So, for example, the function will return the number 3 for the third case (normally, but not always, the third row in the Data View), the number 4 for the fourth case, and so on. The $Casenum variable is just the number of cases read up to and including the current case. This will allow you to select $Casenum in the Functions and Special Variables box. The second thing is to select All in the Function group on the right of the dialog. The first is to specify the name of your target variable in the Target Variable box. There are three things you’ve got to do to set up this box to generate a set of unique identifiers. The Compute Variable dialog box looks like this. We’re going to add a variable that will contain a set of number IDs by using the Transform -> Compute Variable menu item.

The addition of a variable containing integers functioning as unique identifiers will sort out this issue. You’ll be able to see your new ID variable in SPSS’s Data ViewĪs you can see below, we have three variables in our data set, but nothing to distinguish individual cases from each other.Click on All in the Function Group list, and then drag and drop $Casenum into the Numeric Expression box at the top.Give your new variable the name “ID” in the Target Variable box.
