## Counting cases

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

Serpri
Posts: 2
Joined: Thu Mar 05, 2015 9:18 pm

### Counting cases

Hey guys,

I am a beginner in spss. My question is how do you know which cases spss takes/uses just by looking at the syntax.

For example:

COMPUTE hulpb2=(hulpbevalling + 1)*2.
COMPUTE duur=zwangerschapsduur - (9/3).
SELECT IF (hulpb2*duur lt -2).

There is a variable 'hulpbevalling' which contains 2 categories.
And there is a variable 'zwangerschapsduur' which contains 4 categories.

I dont quiete understand what the +1 means? What does the 1 add to?
And what does the *2 mean? I mean what does it multiply?

How can you multiply or add something to a variable? And how can you multiply 2 variables with eachother? What would the answer be then?

Serpz
iopsych
Posts: 25
Joined: Tue Feb 24, 2015 11:58 pm

### Re: Counting cases

Hello Serpri,

In SPSS, you can do pretty much any computation using your variables to create new variables (or to change the values of your existing variables).

Let's say VarA has a value of 3, 2, and 5 for persons A, B, and C, respectively.

When you use the command: VarB = VarA*2

The values for VarB becomes 6,4, and 10 for persons A, B, and C. So you simply multiply every value for that variable (values for each case) by 2.

So the +1 in your syntax simply adds 1 to each case. If your original variable with 4 categories had 1, 2, 3, and 4 as the numerical values for your categories; your new variable becomes 2, 3, 4, and 5. It changes the numerical values for each variable.

Of course you can only use such calculations with numerical data.

I hope this helps.

Yalcin
Serpri
Posts: 2
Joined: Thu Mar 05, 2015 9:18 pm

### Re: Counting cases

Hello Yalcin,

But what if the for example VarA is 'duration of pregnancy'. So VarA has 4 options: 1=less than 34 weeks. 2=35-38 weeks. 3=39-41 weeks and 4=42 or more weeks.

If I add 1 to VarA. What happens?

For example in my attachment you can see this command: COMPUTE zwangerplus=zwangerschapsduur -3.
SELECT IF (zwangerplus =< -1).

My question is how many cases to they select? And how can you see the cases that spss selects here?

Thank you
You do not have the required permissions to view the files attached to this post.
iopsych
Posts: 25
Joined: Tue Feb 24, 2015 11:58 pm

### Re: Counting cases

In that syntax, SELECT IF means it will delete all cases except those zwangerplus equals to or smaller than -1.

So, after executing the file you will only have those cases which have -1 or smaller on the zwangerplus variable.

And if you add 1 to a categorical variable, you simply change the numerical value of that variable and thus the categories of your participants. So those which were "less than 34 weeks" become "35-38 weeks" after the computation.

I hope this helps.

### Who is online

Users browsing this forum: No registered users and 2 guests