SPSS Syntax - Assigning Labels to Multiple Variables

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

dgiacomi
Posts: 1
Joined: Wed Sep 16, 2015 1:50 pm

SPSS Syntax - Assigning Labels to Multiple Variables

Postby dgiacomi » Wed Sep 16, 2015 1:57 pm

Hi all!

I was just wondering if there was a way to automate a certain task. I'd like to assign a "1" or a "2" to specific cases and variables in my data set, which looks like this:

D M W S
3 3 1 2.2
3 3 2 2.2
3 3 1 2.3
3 3 1 2.4
3 3 4 2.5
3 2 6 2.8
3 2 7 2.9
3 2 8 2.6

I would like to add a fifth column and assign a "1" to all of the 3s in the M column, but only to the 3s that are lined up with a 1 in the W column. So I'd like to have something like this:

D M W S 5th
3 3 1 2.2 1
3 3 2 2.2 -
3 3 1 2.3 1
3 3 1 2.4 1
3 3 4 2.5 -
3 2 6 2.8 -
3 2 7 2.9 -
3 2 8 2.6 -

Any help would be greatly appreciated.

Thank you!
JonPedersen
Posts: 119
Joined: Wed May 25, 2011 7:07 am
Contact:

Re: SPSS Syntax - Assigning Labels to Multiple Variables

Postby JonPedersen » Thu Sep 17, 2015 6:24 am

Hi,
If I understand you correctly this can be done as:

Code: Select all

if D=3 and W=1 c5th=1 
if you don't want missing for the 5th col set 5th col to 0 first.
hth
Jon

Who is online

Users browsing this forum: johnnyrut and 3 guests

cron