Skip to main content
Search form
  • 00:06

    ANDY FIELD: Okay in this presentationwe're going to have a look at this Syntax window.Hurrah.Lots of people get scared by the Syntax window,and with good reason, probably.But anyway, we'll try to make you less scared of it, maybe.To open a Syntax window, if we want to do it from scratch,

  • 00:28

    ANDY FIELD [continued]: go to the File menu, and then New, and then Snytax.with a bit of luck, Syntax window will appear.There it is.Okay, now Syntax window, as you can see,is kind of a big, blank space, which is not really what

  • 00:49

    ANDY FIELD [continued]: you want to see in front you.What we can do in the Syntax windowis to tell SPSS to do stuff for us.Now unfortunately, you have to use the language of SPSSto tell it what to do.It's no good writing "Dear SPSS please

  • 01:14

    ANDY FIELD [continued]: do a t-test for me otherwise I will pour teainto the computer."If you write that, and you go and tryto run it as a command, what happens is this.

  • 01:38

    ANDY FIELD [continued]: Oh no, it doesn't recognize the command.That's because SPSS is stupid, and it doesn't reallyunderstand English.Well, kind of does understand English,but it only understands its little stats-y, nerdy versionof English.So we can't write nice, easy stuff like that,and instead we have to write horrible stuff.

  • 01:58

    ANDY FIELD [continued]: Let's say we wanted to do a t-test on our data.Now you might not know what a t-test is yet,but don't worry about it.We still got our data from one of the earlier filmswhere we looked at lecturers and studentsand how many friends they have.So we might want to compare our whether lecturers have

  • 02:19

    ANDY FIELD [continued]: more friends than students.We can do that with t-test.We do that by typing t-testIn version 17, if you don't have version 17 of SPSSthis won't happen, but as you start typing stuff,it gives you a list of commands.You could click on t-test.

  • 02:43

    ANDY FIELD [continued]: We want to tell it what our grouping variable is.In this case our grouping variable is going to be "job."We also need to tell it which numberswe use to represent lecturers and students.Now if you watch the previous film or if you read the book,we used 1 to be "lecturers" and 2 be "students."

  • 03:07

    ANDY FIELD [continued]: All this does is it tells SPSS that we want to analyze.We want to do a t-test, basically.And the groups that we want to compareare the groups in the variable called "job",and the two categories that we want compare categories 1and 2, lecturers and students.Now we can add in some other stuff here.

  • 03:28

    ANDY FIELD [continued]: For example, we need to tell SPSS what variablewe want to compare them on.In other words, the number of friends.As we move on to the next line, whenyou have one of these slashes here,that tells you that it's a sub-command of t-test.T-test is our main command, and we want a sub-command here.

  • 03:49

    ANDY FIELD [continued]: And now SPSS tells us all the sub-commands available to us.For example, we could choose VARIABLES,and this is our outcome variables.We can specify this.Our outcome variable, if we look back at the data,it was called "Friends."We can just type "Friends."

  • 04:13

    ANDY FIELD [continued]: We can also set some other things.For example, maybe we could set the CRITERIAand here we could set up a confidence interval,a 95% confidence interval.Now when you finish writing your command,

  • 04:33

    ANDY FIELD [continued]: you must put a full-stop, like so.Now that basically tells SPSS to do a t-test.To run this t-test, we could click on this button.It plays the bit of syntax that you selected.So we could select something, and then press Play.We could also go to the Run menu, and click on Run All.

  • 04:55

    ANDY FIELD [continued]: That'll run all the syntax that we've written.Or again, if we've selected a bit,we could only on the bit that we want.So let's run this.Then what should happen, is in our Output window,which again, you'll have to look at the separate video

  • 05:16

    ANDY FIELD [continued]: or read the book about the Output window.We get a nice little t-test.We're going to go into the Outputwindow in a different film, so I'm notgoing to talk much about it there,but just to show you that's done the t-test.So Syntax window is a way of writing commands that

  • 05:38

    ANDY FIELD [continued]: allow us to analyze that data.Now, you might think, why the hell do I want to do that?I can just do it through the windows.Well, there's a few reasons, and the first reasonis if you're doing lots and lots of different analyses,it's quite handy to save what doing as syntax in caseyou need to run it all again at some point.

  • 05:59

    ANDY FIELD [continued]: There's also things that you can do with syntax that you can'tdo through the windows, so it's quite a useful thingto know about.Now I'm just going to pause for a minute,and I'm going to illustrate what I mean.What I've done while I was pausingis I've loaded up a new data file, whichis real data file that I was working on at some point.

  • 06:22

    ANDY FIELD [continued]: It's a syntax file, as well, that I was using on this file.Now what I want to show you here doesn't reallymatter what all these commands mean.It's that I was doing a bunch of analyses on a data file,and potentially I'm going to haveto redo these analyses some point in the future.I saved everything I did as different commands.

  • 06:44

    ANDY FIELD [continued]: You can see there's a lot of work here.This is pretty much a day's work, and it's all saved.Now rather than having to spend a day redoing these analyses,should I need to do them in the future,I can just click Run and All and itwill go through all the commands in the Syntax window

  • 07:05

    ANDY FIELD [continued]: and it will do it in about 20 seconds.It will in the long run, save me an enormous amount of time.If you've got big syntax for like this,again if you're using version 17 or after,if you drag that in here you actuallyget a Navigator window for all your commands.If you want to find a specific bit of analysisthat you've done, this can help you do that.

  • 07:28

    ANDY FIELD [continued]: Now the other thing that's worth mentioning about Syntax windowsis that you can get syntax rather than typing it,you can get syntax through the Analyze menu as well.

  • 07:50

    ANDY FIELD [continued]: For example, if we go back to our rather simplert-test example, rather than generating this by typing it,anything you do in SPSS, any analysis you do,so if we were to do an independent t-test like this--

  • 08:13

    ANDY FIELD [continued]: again read the chapter on t-testsand it will be clear what I'm doing.We can set up a t-test like this, and if we click on Paste,the syntax will appear in a Syntax window.That's how you can actually generate syntaxif you want to reuse certain things that maybe you do a lot.You don't necessarily have to type all the commands

  • 08:35

    ANDY FIELD [continued]: in you can just paste it through the Windows menu.You can do a lot of analysis through windows,but paste the syntax at the same timeso that you've got a copy of everything you did.Then if you needed to, you could rerun all of your analysesagain at the push of a button.That's pretty much all you need to know for the time beingabout the Syntax window, and the next film

  • 08:57

    ANDY FIELD [continued]: we'll have a look at the Output window.

Video Info

Series Name: Discovering Statistics Using SPSS

Episode: 9

Publisher: SAGE Publications Ltd

Publication Year: 2012

Video Type:Tutorial

Methods: Syntax, SPSS

Keywords: computer languages; computer programming; mathematical computing; mathematical concepts; Software

Segment Info

Segment Num.: 1

Persons Discussed:

Events Discussed:



Professor Andy Field gives a demonstration of manually entering data into SPSS software. He gives examples of the syntax necessary for getting results and explains why entering data via the syntax window can be beneficial.

Looks like you do not have access to this content.

The Syntax Window

Professor Andy Field gives a demonstration of manually entering data into SPSS software. He gives examples of the syntax necessary for getting results and explains why entering data via the syntax window can be beneficial.

Copy and paste the following HTML into your website