Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
While it's possible to enter data directly into SPSS or download it in the SPSS.sav format, data sets will often come to you in other formats, such as database files, text files, or frequently as spreadsheets, and there are actually advantages to this. Files in these other programs, such as spreadsheets, are usually easier to create and share than our SPSS files. Also, SPSS is well set up to import data from each of these formats. In this movie, I will show you how to work with spreadsheets in Microsoft's .xls and .xlsx format from Excel.
At the end of the movie, I will point you to SPSS's excellent instructions and tutorials on importing data from other sources as well. I'm going to begin by using a data set that I downloaded from Yahoo Financial about the 2,800 stocks in the NASDAQ index. This is called NASDAQ.xls. And what we have here is the Symbol, the Name for each stock, as well as the LastSale Price before I downloaded, the company's Total Market Capitalization, the Year of its initial public offering, its Sector, and its Industry. And if we scroll to the right, you can also see a web link for a summary quote.
Now to import this into SPSS, there are few things I need to do. Number one is I am going to get rid of some information that I just don't want. The information about the summary quotes here, I don't need that, so I am just going to come up here and I am going to delete that column. That makes things a little bit simpler. The second thing is I can't have variables that mix numbers and letters in them or SPSS treats them entirely as String variables or Word variables. The most egregious example here is the IPOYear. You see it says 1999 at the top, and then we have several N/As for Not Available, and what I need to do is I need to get rid of those N/As so SPSS will treat as strictly as a numerical variable.
The easiest way to do that is to sort the column. I just click on a cell in there and come up to Sort, and I see we go from 1970 and I can just scroll down. There we go. I see I can select all of the N/As. I start there and come down to row 2821, I Shift+Click, and then I can just hit Clear Contents. Now I also need to check the other two dollar values, the LastsSale and the MarketCap, just to double-check.
I am going to going to click on LastSale and I will sort that. See, it goes down to 1 cent. What's up at the top? Okay, I have a few N/As in there too, and if I left those in there, those three values could turn the 2800 and 18 others into String variables, so I don't want that. I'll press Clear Contents, and then I have a few here under MarketCap. I will clear those. I am going to sort MarketCap separately, just to double-check.
And look, we have one more right there. Once we have done that, I believe we are ready to import this. It's okay that I have N/As in Sector because that's a text variable anyhow. I am just going to come back over to the first column, Symbol, column A, and sort that by the Symbol again from top to bottom. So we start at the Australia Acquisition Corp. I am going to save this data set, and then I need to close it because SPSS can't open it if it's open in Excel.
So I am going to close the data set, minimize this, and here I am in SPSS now. If I just come over to File, to Open, to Data Set, and I simply navigate to the folder where I have this spreadsheet, now I need to tell SPSS that I am looking for a spreadsheet, because right now it's trying to report on .sav files. I come down to spreadsheets, and now it shows up, and I can just double-click on it to open it. It gives me a suggested range of the data. If there's more than one worksheet in the spreadsheet, it automatically suggests the first one; but if you have others, you can navigate to them in this way.
But I am going to use data--that's the Name of the worksheet--cells A1 to G2821. I will just press OK, and there we go. You see, for instance, that the variable names are listed across the top in the blue row and we have the Symbol, the Name, the LastSale, and the MarketCap, the IPO. Now in IPO I cleared out the N/As, and those were blank cells in Excel. Here they have dots. A dot is what goes into a blank numeric cell in SPSS.
So actually, that still indicates that those are missing. I am going to scroll over to the right for minute and see what else we have. We have Industry. I am going to make that little skinnier by just dragging it over,. I am going to come back, and I will take the Name, and I will make that skinnier so I can see more of the data. I do need to fix a couple of things. The LastSale and the MarketCap are both dollar values, and I need to turn them into dollar values and change the decimal places for both of them. So what I am going to do as I can either click on the Variable View tab at the bottom left or I can simply double-click on the name of the variable.
I will do that. And I can go to Type, until it's a Dollar value. And I will click this one down to the bottom, just two decimal places, and that should do. The LastSale, the highest value is in the thousands, but I do need to have two decimal places because they do use the cents. On the other hand, MarketCap is huge numbers. It goes up to hundreds of billions, and I don't need decimal places. I am going to tell that one that it's a Dollar value as well.
I will give it room for a lot of numbers, but no decimal places. I'm going to click OK, and now I can go back to the Data view and see what we got--and that looks like the correct format. And now I can simply save this data file as NASDAQ, and we are good to go. Now I want to show you that SPSS is able to import straight from databases or text files. In fact, if you go over to File, you will see here we have a command for opening from a database or reading text data.
Now I am not going to go through those. Instead, right now, I am just going to point you over to the Help menu, to Tutorial. When you click on that, this will open up web browser, even though it's a local file, and the Tutorial, I want you to see this one: Reading Data. And in fact, if we open that up, you can see Reading from a Database. And SPSS has a tutorial that will walk you through every step that you need, using a similar procedure to get the data from a database and into SPSS.
And so you see, with the proper preparation, it's a straightforward procedure to get data from one source--a spreadsheet, a text file, a database--into SPSS, so can begin exploring your data and seeing what your numbers can tell you.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.