compute new variable from string text

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

compute new variable from string text

mattwro
I'm trying to create a new variable based on the contents of a string. I have e-mail addresses for a set of survey respondents, and I want to create a variable that will categorize the respondents as either "internal" or "external". Internal respondents would be those whose e-mail addresses contain my company name, for example "jsmith@abc.com" would be internal while any e-mail addresses that do not contain "abc.com" would be external. Any ideas? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: compute new variable from string text

Rick Oliver-3
compute newvar=index(stringvar, "abc.com")>0.

Newvar will be 1 for all cases of stringvar that contain "abc.com" and 0 for those that do not.



From:        mattwro <[hidden email]>
To:        [hidden email]
Date:        02/15/2011 01:22 PM
Subject:        compute new variable from string text
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I'm trying to create a new variable based on the contents of a string. I have
e-mail addresses for a set of survey respondents, and I want to create a
variable that will categorize the respondents as either "internal" or
"external". Internal respondents would be those whose e-mail addresses
contain my company name, for example "[hidden email]" would be internal
while any e-mail addresses that do not contain "abc.com" would be external.
Any ideas? Thanks!
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/compute-new-variable-from-string-text-tp3386478p3386478.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