 The last thing I want to say in SPSS about accessing data is about importing data. And you know, compared to entering it manually, it just makes me feel like this. And I resort to cheesy clip art to show how happy I am. Because no doubt about it, importing is absolutely the best way to go if you want to get data into SPSS. Now the nice thing is SPSS can open text files, it can open CSV or comma separated value files, and even XLSX, that's Excel files, as long as they're formatted, right? Now, what do I mean by formatted, right? There's a term from Hadley Wickham in the R developer community, tidy data, and it's referring to something very specific. It says that your file should have only one sheet. So that's one worksheet, even though Excel can take more than that, that each column should be exactly equal to one variable, and that each row should be equal to one case. And an important thing is no funny stuff in your Excel sheet, because Excel is very flexible. And when I refer to funny stuff, I'm talking about things like macros and formulas and graphs and formatting and comments or merge cells, or headers taking up their own rows, or duplicating row numbers, you don't want any of that. Basically, you want to treat it like a CSV file. And if you do that, then you find you can import it very easily into SPSS. And in fact, let me show you how this works. We're going to try this in SPSS, but I want you to do two things. First, I want you to download the course files, and that will include a zipped folder by this name that ends with data sets. That's going to have three files inside it. I'll show you those in just a second. And then you can also open up this syntax file that will work with them. But let's go to see what's inside the folder and explain a little bit what's going to happen here. The folder that I've asked you to download contains three different files. Now, I have both the folder here, and I have the three files saved separately next to it, but normally they would be inside it. But for the syntax to work properly, you want them sitting separately on the desktop. All three of them contain the same data it says MBB, which stands for Mozart, Beethoven and Bach, because this is Google Trends data about the popularity of search for each of these three composers names since 2004. This first one is in CSV or comma separated value format. The second one is a plain text file, and it's tab separated. And the third one is an XLSX file. So it's an Excel sheet. And you can see it's the same number, but it appears a little bit differently when I do the quick view here on my Macintosh. What we're going to do then is open up the syntax file. And we're going to see what we need to do to import each of these. Now, I've saved the syntax, but the fact is, it's easier to do this stuff through the menus. Now I give some information here about using the file path. In each of these syntax commands, I have to specify the file location. Now this is the format. If you're on a Macintosh, like I am, of course, you'll want to change Bart to be the name of your home directory. If you're on a Windows computer, you're going to need to change it to something a little more like this, or possibly depending on the version of your operating system, using backslashes instead. Anyhow, I'm going to show you how to import each of these. And I've got the duplicate information here in the script, in case you want to run it that way. But it's actually really easy to do it from the menus. So here's what I'm going to do. I'm going to come up to my data window, I'll just click over to that. And my data window is empty right now. I'm going to go to file, open and data. You do that if you're opening an existing SPS file, or if you're importing something in a different format. Now here I'm on the desktop, you can see my folder there. But you can't see the three data files I have next to it, because right now, it's only going to display files that are in the dot save. That's the SPSS proprietary data format. I'm going to click on that, and come way down here. And we'll start with the text file, the TXT version. So I'm going to hit that. And now you can see that it's there. I'll select that file, and I'll click open. So now I have the SPSS text import wizard. And we can scroll through most of this pretty quickly. It has if it matches a predefined format, something that would have saved somewhere else, it doesn't. It has if they're delimited, yes, they're delimited by tabs in this case, are the variables included at the top of the file, you see how they show up here as the first row? Well, I click yes. And now it excludes us because it knows that those need to be the in the header of the data file. It continue. Each line represents a case. I want all of the cases. You could sample from it if you had a very large data set, and it would allow you to do exploratory analysis more quickly than you could otherwise. It asks what delimiters appear. Now by default, a text file, the one that I have uses tabs in it knows that it asks about text qualifiers, I don't have text qualifiers in here. So I just hit continue don't have to change anything. Now I have dates here at the beginning and they are year dash month. Now, SPSS can handle dates. However, it doesn't like the fact that I'm using year and month without the day associated with it. Consequently, I'm going to leave it just as a string variable as a text variable, and it still works properly in any analyses I want to do. So that's fine. I'm just going to hit continue not changing anything here. It asked if I'd like to save the file format for future use. That's the thing I was referring to in the first dialogue here. And that's if I want to paste the syntax, I could do that, but I've already got it pasted. I'm just going to hit done. And there it is, it's opened it up, and it's formatted properly. If we go to variable view, you can see it's got a string variable, it's got three numeric variables, it has the proper number of digits, has the proper number of no decimal places, and it recognizes them as nominal, which actually is not the case. So I actually need to come here and change that to a scaled variable. Because the data that you get from Google Trends is sort of zero to one percentages in terms of relative popularity search terms. So I change that to scale. And otherwise, I'm good to go. Now let's do the same thing, but with a CSV file. To do that, I'm just going to get rid of this data file, I'll just open up a new one. There we go. I'll come back up to the file and open to data. This time I need to tell I'm looking for a CSV. But if you remember, that's actually under text. So I click here. And except this time, instead of selecting the .txt file, I'll select the .csv file. And what you find is that the procedure is almost identical. There's only one super tiny change here. I hit continue. I tell the variable names are at the top. It is delimited. It needs to know that each line is a case, I just hit continue on all this. Here's the one difference. When I did the text file tab was automatically selected. Now that I'm doing a CSV, which means comma separated values, comma is automatically selected. I hit continue. It does the same thing with months, we're going to leave it a string I hit continue. And I can hit done. And you see, it looks exactly the same. I do have the same issue though, that these three numbers, which go from zero to 100 are coded as nominal, I need to change them manually to scale, right? And now we'll do the third one, an Excel file. Now, in a lot of programs, you get very stern warnings about importing Excel files. And there's good reasons for that. Because Excel files are very flexible, and people can put a lot of stuff in there, again, comments and changing column widths and merging cells that make it easy to use Excel just for displaying information. But if you're importing, you don't want to do that. Fortunately, I have it set up as tidy data already. columns are the same as variables, rows are the same as cases, there's nothing else in there. And so what I can do in this case is come to file, open, we'll go to data again. And this time, I come down to this one, it actually has Excel file as a format. There it is, I'll hit open and you'll see that the dialogue is different in this case. It says opening Excel data source instead of the text import wizard. It says read the variable names from the first row that's checked by default. It knows how many rows of data I have. And it's got this thing about maximum width, I don't need to worry about that. I just hit okay. And that was that. Here's the data from Excel. It's the same data, I still need to change these three measures manually, you could save this information in syntax if you're going to be doing it many times over. But that is sufficient for what I need. And so it turns out that importing information into SPSS is really easy. And it's massively more efficient and easier to do than entering it directly. You do it in a spreadsheet, especially if you did on Google Sheets, if you're entering stuff manually, you can collaborate on it. And then you save it as a CSV file and you pop it in there. And then you can get straight to your analysis. And that is the point of all this work anyhow.