From the course: SPSS Statistics Essential Training (2019)

Importing data - SPSS Tutorial

From the course: SPSS Statistics Essential Training (2019)

Start my 1-month free trial

Importing data

- [Instructor] Before you can start working your data magic, you actually have to get your data into SPSS. And by far the easiest way to do that is to import it from a spreadsheet. You can do this either in Microsoft Excel, Google Sheets, or some other application that can save as CSV files, or comma separated values. Right here, I have a data set I created that is in Excel, and what it has is information about the 48 continental United States. We have the state name, the code, the region that it's in, whether the governor is Republican or Democrat, and a little bit of information about personality. Now, please note, those are currently coded with numbers because that's they way SPSS likes to do things. Normally, if you're entering this just in Excel, you would put in the words to say, for instance, northeast, south, midwest, west for region. But, with SPSS you do the numbers and then you layer variable labels and value labels on top of it. I'm going to show you how those work in another video. But right now, I'm showing you that you enter it as numbers. And, that you can take this information and you can import it into SPSS. What I have is personality information calculated as averages at a state level that comes from some psychological research. And then I have 12 variables here that are from Google Correlate, which indicate the relative popularity of a dozen different search terms. Now, fortunately I've got a little tab right here under codes that tells you what every thing is and what it all means. So, these are the region categories. These are the governor parties. The psych variables, talk about extraversion and agreeableness, and then the Google Correlate search terms include things like searching for Instagram, and privacy, and Scrapbook. So, these are some of the variables that we're going to use as a running example throughout the course. But, let me show you how to get them in. Now, I do want to mention that I provided two examples of this one is as an Excel spreadsheet, which is the one that we're looking at right now. But, I also have this same data saved as a CSV file, comma separated values, which is like the plain text version of a spreadsheet. And the way you get these in to SPSS works a little differently for the two. So, let's go to SPSS and see how to do it. So, right here in SPSS I'm confronted with a blank data sheet, this is what you're going to see when first open SPSS. But, let's do this, let's go to file and we can either go to Open, or we can go to Import. Now, if you're doing something like Database, you're going to want to go through Import. But, it turns out that for what we're doing, the Open Data command works just fine. So, I'm going to do Open Data, and then if you get to the folder where you've downloaded the course files for this, and then you come right here, and select Excel file, and that can download Excel S, Excel SX, and Excel S Macro files even. When you do that, you see we've got a small number of choices here. And, I want to open this one right here which has the State Data in an Excel format. I'm going to click Open. And it's going to bring up a short dialog, and ask where the data is, it's going to ask about whether it has variable names in the first row, which it does. And then, I'm going to check off these two things right here also, remove leading spaces, and remove trailing spaces. These are invisible spaces that might be at the beginning or end of text data. And those can cause SPSS to read values that appear similar as different values, so I find it helpful. And then, simply, press Okay. Now, I do want you to know that you can save this as Syntax and once I close this blank one, because it opened it up behind it. There, we've got that one. Here's the Dataset. And I do want to show you, we're going to do the same command with Syntax. I'm going to bring this up for just a moment. And here's the Syntax file that I saved that will also open Datasets. It uses a neat little trick, called a File Handle, which is like an alias for a folder. So, once you've saved everything to your computer, you can use this File Handle to put the initial part of the file path and you can copy it in there. And then from then on, you can use these relative references to simply tell SPSS look in this folder over here. And, we can use these same commands from here on out. But, you do need to figure out where the path is on your computer. It's going to be obviously different than it is on mine. But, you can get that by opening something in SPSS and the output will show you the path you can copy and paste it from there. But, I do want to show you what the data looks like when it's imported, so let's come back here to the Data window. Basically, it's good to go. There are two problems which are cosmetic that I want to fix. Number one, is this columns way too skinny. So, I'm going to come over here and click on it and try to stretch it out to about the same width as the others. And then, these ones over here I have way too many decimal places. Only the first three decimals have actual data, it's all zeros after that. So, let's come here to variable view. And, I'm going to show you a little trick. If I come over here to decimals, this column has decimals and I change the first one to three, I'm going to do three and I'm going to copy that value. Then I can go to the ones below with my copied value and just paste them in. I'm going to do the down arrow, and I'm going to copy in three for each of these. You can also do that manually. And there is in fact a way to do this with Syntax as well, but that's a little more elaborate. And then I come here to Data View and now you see we have just a three decimal places. We got the right width for each of the columns. And now we have data that we're ready to start working with and prepare for our analysis.

Contents