Creating a dummy based on multiple conditions SYNTAX

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

gionzarini
Posts: 5
Joined: Thu Jun 26, 2014 4:28 pm

Creating a dummy based on multiple conditions SYNTAX

Postby gionzarini » Tue Jul 01, 2014 10:59 am

Hi,

I am entirely new to Syntax, and I'm trying to learn some basic functions.

I want to create a new dummy variable based on the conditions that two other existent dummies take value 1.


I have tried with the following code, but the result is a column of missing values.

COMPUTE ExtPrivFin = 0.
IF q12.3 = 1 AND q13.3 = 1 ExtPrivFin = 1. What is wrong with this?


For some reason, even if I only say COMPUTE ExtPrivFin = 1 it returns only missing values.

Thank you for your help!
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Creating a dummy based on multiple conditions SYNTAX

Postby GerineL » Tue Jul 01, 2014 11:38 am

try:

COMPUTE ExtPrivFin = 0.
IF (q12.3 = 1 AND q13.3 = 1) ExtPrivFin = 1.
execute.


(maybe your transformations are still pending?)
gionzarini
Posts: 5
Joined: Thu Jun 26, 2014 4:28 pm

Re: Creating a dummy based on multiple conditions SYNTAX

Postby gionzarini » Tue Jul 01, 2014 2:19 pm

Thank you GerineL!

I have read some stuff and it seems that the problem is that COMPUTE needs that the data on which to work is defined first.
(is that what you mean by transformations pending?)

How do I do that?

Thanks a lot!
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Creating a dummy based on multiple conditions SYNTAX

Postby GerineL » Wed Jul 02, 2014 8:43 am

Could you maybe post your output including the error messages here?

When it says something about defining data, it usually means that there is no dataset open / active.
gionzarini
Posts: 5
Joined: Thu Jun 26, 2014 4:28 pm

Re: Creating a dummy based on multiple conditions SYNTAX

Postby gionzarini » Wed Jul 02, 2014 2:19 pm

Solved!

It was about telling SPSS what variables to use through LIST command.

Thanks!

Who is online

Users browsing this forum: No registered users and 1 guest

cron