Merging string variables help

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Merging string variables help

Maria Suchard
Hello List,

Please, please I need your help.  I have a large data set with 2 string variables.  The variables in question are both email variables and I need this variable to be in my final data set.  I have found the "recode into a different variable" option and I can copy 1 of the variables into a new field. But I can't figure out how to get it to copy the second variable into the new variable if the first email variable is null.

What I need it to do is something like this:
Variables Email1 & Email2
If(Email1=not null (populated) = new variable)
IF(Email1=is null (not populated), use Email2= new variable)
IF (Email1=not null & Email2=not null, then use Email1=new variable)

I would greatly appreciate any help.

Thank you in advance!
Maria


Reply | Threaded
Open this post in threaded view
|

Re: Merging string variables help

Bruce Weaver
Administrator
Something like this, perhaps?

STRING NewEmail(a50).
COMPUTE NewEmail = Email1.
IF (NewEmail EQ "") NewEmail = Email2.



Maria Suchard wrote
Hello List,

Please, please I need your help.  I have a large data set with 2 string variables.  The variables in question are both email variables and I need this variable to be in my final data set.  I have found the "recode into a different variable" option and I can copy 1 of the variables into a new field. But I can't figure out how to get it to copy the second variable into the new variable if the first email variable is null.

What I need it to do is something like this:
Variables Email1 & Email2
If(Email1=not null (populated) = new variable)
IF(Email1=is null (not populated), use Email2= new variable)
IF (Email1=not null & Email2=not null, then use Email1=new variable)

I would greatly appreciate any help.

Thank you in advance!
Maria
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Merging string variables help

Rick Oliver-3
In reply to this post by Maria Suchard
Use DO IF and COMPUTE.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Maria Suchard <[hidden email]>
To:        [hidden email],
Date:        06/20/2014 09:06 AM
Subject:        Merging string variables help
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hello List,

Please, please I need your help.  I have a large data set with 2 string
variables.  The variables in question are both email variables and I need
this variable to be in my final data set.  I have found the "recode into a
different variable" option and I can copy 1 of the variables into a new
field. But I can't figure out how to get it to copy the second variable into
the new variable if the first email variable is null.

What I need it to do is something like this:
Variables Email1 & Email2
If(Email1=not null (populated) = new variable)
IF(Email1=is null (not populated), use Email2= new variable)
IF (Email1=not null & Email2=not null, then use Email1=new variable)

I would greatly appreciate any help.

Thank you in advance!
Maria






--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Merging-string-variables-help-tp5726556.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD