Can you create 2 variables with the same line of code?

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

jennmorell
Posts: 2
Joined: Wed May 01, 2013 6:03 pm

Can you create 2 variables with the same line of code?

Postby jennmorell » Wed May 01, 2013 6:16 pm

I need to create two new variables for the minimum length of a jail sentence and the maximum length of a jail sentence. Can both variables be created with one line of code? What would that code look like? Here is an example of what we are trying to do:

IF OldVariable1 < 2 NewVariable1=4 NewVariable2=6.

**NewVariable1 would equal the minimum sentence and NewVariable2 would equal the maximum sentence.

Does anyone have any insight on this? Or do we actually have to write two lines of code to create these variables.
Analyst Techy
Moderator
Posts: 22
Joined: Mon Apr 27, 2009 2:19 am
Location: Melbourne, Australia

Re: Can you create 2 variables with the same line of code?

Postby Analyst Techy » Thu May 02, 2013 12:12 am

Hi jennmorell.

Thanks for defining the new variable, but what is the definition of oldvariable, and what does oldvar<2 mean?

Analyst Techy
Analyst Techy

NOTES:
Any solutions I provide on this forum are free of charge, donations go towards the maintenance of the unaffiliated SPSS forum.
jennmorell
Posts: 2
Joined: Wed May 01, 2013 6:03 pm

Re: Can you create 2 variables with the same line of code?

Postby jennmorell » Thu May 02, 2013 2:57 pm

We want the expression to read like this.

IF OldVariable LT 2 NewVariable1=4 NewVariable2=6.

Who is online

Users browsing this forum: No registered users and 3 guests

cron