Searching Strings with extendedTransforms

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

Searching Strings with extendedTransforms

ntw2012
Hi,

I know this is a fairly basic question, but I have no experience with Python and just need a kickstart. I have used the rudimentary string searching functions in SPSS, but I think this task would benefit from the Python extendedTransforms function.

I'm running SPSS 20.0.1 on Mac OS X 10.7.3 and have installed the latest Python tools as well as the extendedTransforms module.

The task consists of searching two string variables for text strings, and then flagging those cases when the conditions are true. For example, if str1 contains "light" and str2 contains "gas", we'd want a new variable (lightorgas) to equal one. There will be 30 to 50 such rules, some of which will be ANDs and some which will be ORs.

I'm just looking for some example code that would get this done.

Thanks! I really appreciate it. I expect I'll be able to pick up Python fairly quickly but I have no idea where to start (I have looked at the guides but I'm a much better hands-on learner).
Reply | Threaded
Open this post in threaded view
|

Re: Searching Strings with extendedTransforms

David Marso
Administrator
1. What is wrong with the "rudimentary" string function INDEX?
COMPUTE lightORgas=INDEX(str1,"light") GT 0 OR INDEX(str2,"gas") GT 0.
2.  Why do people believe they need to resort to Python to perform trivial computations?
--
ntw2012 wrote
Hi,

I know this is a fairly basic question, but I have no experience with Python and just need a kickstart. I have used the rudimentary string searching functions in SPSS, but I think this task would benefit from the Python extendedTransforms function.

I'm running SPSS 20.0.1 on Mac OS X 10.7.3 and have installed the latest Python tools as well as the extendedTransforms module.

The task consists of searching two string variables for text strings, and then flagging those cases when the conditions are true. For example, if str1 contains "light" and str2 contains "gas", we'd want a new variable (lightorgas) to equal one. There will be 30 to 50 such rules, some of which will be ANDs and some which will be ORs.

I'm just looking for some example code that would get this done.

Thanks! I really appreciate it. I expect I'll be able to pick up Python fairly quickly but I have no idea where to start (I have looked at the guides but I'm a much better hands-on learner).
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
CG
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Searching Strings with extendedTransforms

CG

I am out of the office until Monday June 18.  For immediate assistance please contact Jessica Jaramillo ([hidden email]). Thank you.

Reply | Threaded
Open this post in threaded view
|

Re: Searching Strings with extendedTransforms

Jon K Peck
In reply to this post by David Marso
What Python brings to the table here is the ability to use regular expressions for pattern matching.  For simple fixed strings, the built-in capabilities are fine, but for a complex pattern, Python runs rings around trying to program the expression logic.

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        06/14/2012 02:08 PM
Subject:        Re: [SPSSX-L] Searching Strings with extendedTransforms
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




1. What is wrong with the "rudimentary" string function INDEX?
COMPUTE lightORgas=INDEX(str1,"light") GT 0 OR INDEX(str2,"gas") GT 0.
2.  Why do people believe they need to resort to Python to perform trivial
computations?
--

ntw2012 wrote
>
> Hi,
>
> I know this is a fairly basic question, but I have no experience with
> Python and just need a kickstart. I have used the rudimentary string
> searching functions in SPSS, but I think this task would benefit from the
> Python extendedTransforms function.
>
> I'm running SPSS 20.0.1 on Mac OS X 10.7.3 and have installed the latest
> Python tools as well as the extendedTransforms module.
>
> The task consists of searching two string variables for text strings, and
> then flagging those cases when the conditions are true. For example, if
> str1 contains "light" and str2 contains "gas", we'd want a new variable
> (lightorgas) to equal one. There will be 30 to 50 such rules, some of
> which will be ANDs and some which will be ORs.
>
> I'm just looking for some example code that would get this done.
>
> Thanks! I really appreciate it. I expect I'll be able to pick up Python
> fairly quickly but I have no idea where to start (I have looked at the
> guides but I'm a much better hands-on learner).
>


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Searching-Strings-with-extendedTransforms-tp5713673p5713674.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


Reply | Threaded
Open this post in threaded view
|

Re: Searching Strings with extendedTransforms

David Marso
Administrator
Why hasn't SPSS development bothered to add regular expressions to the base system.
Long overdue!
--
Jon K Peck wrote
What Python brings to the table here is the ability to use regular
expressions for pattern matching.  For simple fixed strings, the built-in
capabilities are fine, but for a complex pattern, Python runs rings around
trying to program the expression logic.

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:   David Marso <[hidden email]>
To:     [hidden email]
Date:   06/14/2012 02:08 PM
Subject:        Re: [SPSSX-L] Searching Strings with extendedTransforms
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



1. What is wrong with the "rudimentary" string function INDEX?
COMPUTE lightORgas=INDEX(str1,"light") GT 0 OR INDEX(str2,"gas") GT 0.
2.  Why do people believe they need to resort to Python to perform trivial
computations?
--

ntw2012 wrote
>
> Hi,
>
> I know this is a fairly basic question, but I have no experience with
> Python and just need a kickstart. I have used the rudimentary string
> searching functions in SPSS, but I think this task would benefit from
the
> Python extendedTransforms function.
>
> I'm running SPSS 20.0.1 on Mac OS X 10.7.3 and have installed the latest
> Python tools as well as the extendedTransforms module.
>
> The task consists of searching two string variables for text strings,
and
> then flagging those cases when the conditions are true. For example, if
> str1 contains "light" and str2 contains "gas", we'd want a new variable
> (lightorgas) to equal one. There will be 30 to 50 such rules, some of
> which will be ANDs and some which will be ORs.
>
> I'm just looking for some example code that would get this done.
>
> Thanks! I really appreciate it. I expect I'll be able to pick up Python
> fairly quickly but I have no idea where to start (I have looked at the
> guides but I'm a much better hands-on learner).
>


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Searching-Strings-with-extendedTransforms-tp5713673p5713674.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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Searching Strings with extendedTransforms

Sarraf, Shimon Aaron



I am currently out of the office and will return Tuesday, June 19. I will respond to your email upon my return. If you need immediate assistance, please call 812-856-5824.

Thank you,

 

Shimon Sarraf

Center for Postsecondary Research

Indiana University Bloomington

 

Reply | Threaded
Open this post in threaded view
|

ENGAGEMENT INDEX

Lorin Drake
In reply to this post by David Marso

Good afternoon:

 

We have been asked to create an ‘Engagement Index’ for a client and, in all likelihood will be looking at the following questions in the form of an online survey to 1000+ respondents.

 

Can someone recommend the way they would create this index?

We have several approaches but are wondering if there are any ‘best practices’ out there.

We’re an SPSS shop so ideally, we’d like to know how to conduct this analysis in SPSS.

 

Hands-on, detailed instructions would be appreciated so that we can duplicate it in SPSS.

Below is the Engagement battery.

 

Engagement

§  Overall, how satisfied are you with [CLIENT COMPANY]?

§  How likely are you to make another purchase from [CLIENT COMPANY]?

§  Why are you unlikely to purchase from [CLIENT COMPANY] again?

§  How likely are you to recommend [CLIENT COMPANY] to a friend or family member?

§  Why are you unlikely to recommend [CLIENT COMPANY] to a friend or family member?

§  Using a scale from 1 to 5, please tell us how much you agree or disagree with each of the following statements about [CLIENT COMPANY].

o   [CLIENT COMPANY] is a name I can always trust.

o   [CLIENT COMPANY] always delivers on what they promise.

o   [CLIENT COMPANY] always treats me fairly.

o   If a problem arises, I can always count on [CLIENT COMPANY] to reach a fair and satisfactory resolution.

o   I feel proud to be a [CLIENT COMPANY] customer.

o   [CLIENT COMPANY] always treats me with respect.

o   [CLIENT COMPANY] is the perfect company/retailer for people like me.

o   I can't imagine a world without [CLIENT COMPANY].

 

 

Any help would be much appreciated. Thanks in advance.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: ENGAGEMENT INDEX

Gene Lyle-2
A couple of points:

1. If you're an "SPSS shop" you should already have a clue as to how data like this can be analyzed.
2. Lots of people on this list get payed to answer questions like this. Asking folks to do it for free is a bit of a stretch, IMHO. Especially the "hands-on, detailed instructions" part.

Gene Lyle
Mpls. MN


On 6/14/2012 6:57 PM, Lorin Drake wrote:

Good afternoon:

 

We have been asked to create an ‘Engagement Index’ for a client and, in all likelihood will be looking at the following questions in the form of an online survey to 1000+ respondents.

 

Can someone recommend the way they would create this index?

We have several approaches but are wondering if there are any ‘best practices’ out there.

We’re an SPSS shop so ideally, we’d like to know how to conduct this analysis in SPSS.

 

Hands-on, detailed instructions would be appreciated so that we can duplicate it in SPSS.

Below is the Engagement battery.

 

Engagement

§  Overall, how satisfied are you with [CLIENT COMPANY]?

§  How likely are you to make another purchase from [CLIENT COMPANY]?

§  Why are you unlikely to purchase from [CLIENT COMPANY] again?

§  How likely are you to recommend [CLIENT COMPANY] to a friend or family member?

§  Why are you unlikely to recommend [CLIENT COMPANY] to a friend or family member?

§  Using a scale from 1 to 5, please tell us how much you agree or disagree with each of the following statements about [CLIENT COMPANY].

o   [CLIENT COMPANY] is a name I can always trust.

o   [CLIENT COMPANY] always delivers on what they promise.

o   [CLIENT COMPANY] always treats me fairly.

o   If a problem arises, I can always count on [CLIENT COMPANY] to reach a fair and satisfactory resolution.

o   I feel proud to be a [CLIENT COMPANY] customer.

o   [CLIENT COMPANY] always treats me with respect.

o   [CLIENT COMPANY] is the perfect company/retailer for people like me.

o   I can't imagine a world without [CLIENT COMPANY].

 

 

Any help would be much appreciated. Thanks in advance.

 

 


Reply | Threaded
Open this post in threaded view
|

Re: ENGAGEMENT INDEX

Sonia Brandon-2
In reply to this post by Lorin Drake
Sorry about that.  Looks like it is Likert scale driven.  You would need to do
both an exploratory factor analysis and reliability using Cronbach's, and only
AFTER testing the instrument.  While I appreciate what Gene is saying, I think
it was incredibly rude, and if you need me to talk you through it, or help
interpret, I have taught Stats at the University of Colorado, and currently
teach Methods at Colorado Mesa.  I spent my private sector life validating
instruments.  There are definitely best practices.  Email me, and I will contact
you.


No need for jack-a's to be commenting.  I would imagine you are just trying to
figure things out..  Gene - you are completely out of line.  This is a place for
people to get help.  Quit being such a b.

Sonia Brandon, Ph.D.
Director, Institutional Research
Mesa State College
1100 North Avenue
Grand Junction, CO  81501
phone: (970) 248-1884
fax:  (970) 248-1812
email: [hidden email]

>>> Gene Lyle  06/14/12 6:33 PM >>>
A couple of points:

1. If you're an "SPSS shop" you should already have a clue as to how
data like this can be analyzed.
2. Lots of people on this list get payed to answer questions like this.
Asking folks to do it for free is a bit of a stretch, IMHO. Especially
the "hands-on, detailed instructions" part.

Gene Lyle
Mpls. MN


On 6/14/2012 6:57 PM, Lorin Drake wrote:

>
> Good afternoon:
>
> We have been asked to create an 'Engagement Index' for a client and,
> in all likelihood will be looking at the following questions in the
> form of an online survey to 1000+ respondents.
>ve
> Can someone recommend the way they would create this index?
>
> We have several approaches but are wondering if there are any 'best
> practices' out there.
>
> We're an SPSS shop so ideally, we'd like to know how to conduct this
> analysis in SPSS.
>
> Hands-on, detailed instructions would be appreciated so that we can
> duplicate it in SPSS.
>
> Below is the Engagement battery.
>
> *Engagement *
>
> §Overall, how satisfied are you with [CLIENT COMPANY]?
>
> §How likely are you to make another purchase from [CLIENT COMPANY]?
>
> §Why are you unlikely to purchase from [CLIENT COMPANY] again?
>
> §How likely are you to recommend [CLIENT COMPANY] to a friend or
> family member?
>
> §Why are you unlikely to recommend [CLIENT COMPANY] to a friend or
> family member?
>
> §Using a scale from 1 to 5, please tell us how much you agree or
> disagree with each of the following statements about [CLIENT COMPANY].
>
> o[CLIENT COMPANY] is a name I can always trust.
>
> o[CLIENT COMPANY] always delivers on what they promise.
>
> o[CLIENT COMPANY] always treats me fairly.
>
> oIf a problem arises, I can always count on [CLIENT COMPANY] to reach
> a fair and satisfactory resolution.
>
> oI feel proud to be a [CLIENT COMPANY] customer.
>
> o[CLIENT COMPANY] always treats me with respect.
>
> o[CLIENT COMPANY] is the perfect company/retailer for people like me.
>
> oI can't imagine a world without [CLIENT COMPANY].
>
> Any help would be much appreciated. Thanks in advance.
>

=====================
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
Reply | Threaded
Open this post in threaded view
|

Engagement Index

Wayne Parker
In reply to this post by Lorin Drake
While Sonia found Gene's tone rude, it was accurate - you've hired yourself out as an expert and don't have a clue how to do the project - I consider that unethical.

Sent from my iPhone

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: ENGAGEMENT INDEX

Jerabek Jindrich
In reply to this post by Lorin Drake
Hello,

few notes rather from marketer point of view than statistical.
1. 5 questions in the begining meassure 3 things, we could call it Satisfaction,Repurchase, Recommendation.  Can be used to construct overall index, but as questions 2-3 and 4-5 measure the same thing in reverse wording, do not sum/average them with 1st question. Compute  repurchase and recomendation and then sum with satisfaction.

2. Following questions measure particular features of the CLIENT COMPANY. There is chance to assign weights to features, based on correlation between overall index and satisfaction with the feature.


HTH

Jindra


> ------------ Původní zpráva ------------
> Od: Lorin Drake <[hidden email]>
> Předmět: ENGAGEMENT INDEX
> Datum: 15.6.2012 02:11:28
> ----------------------------------------
> Good afternoon:
>
>
>
> We have been asked to create an 'Engagement Index' for a client and, in all
> likelihood will be looking at the following questions in the form of an online
> survey to 1000+ respondents.
>
>
>
> Can someone recommend the way they would create this index?
>
> We have several approaches but are wondering if there are any 'best practices'
> out there.
>
> We're an SPSS shop so ideally, we'd like to know how to conduct this analysis in
> SPSS.
>
>
>
> Hands-on, detailed instructions would be appreciated so that we can duplicate it
> in SPSS.
>
> Below is the Engagement battery.
>
>
> Engagement
>
> §  Overall, how satisfied are you with [CLIENT COMPANY]?
>
> §  How likely are you to make another purchase from [CLIENT COMPANY]?
>
> §  Why are you unlikely to purchase from [CLIENT COMPANY] again?
>
> §  How likely are you to recommend [CLIENT COMPANY] to a friend or family
> member?
>
> §  Why are you unlikely to recommend [CLIENT COMPANY] to a friend or family
> member?
>
> §  Using a scale from 1 to 5, please tell us how much you agree or disagree with
> each of the following statements about [CLIENT COMPANY].
>
> o   [CLIENT COMPANY] is a name I can always trust.
>
> o   [CLIENT COMPANY] always delivers on what they promise.
>
> o   [CLIENT COMPANY] always treats me fairly.
>
> o   If a problem arises, I can always count on [CLIENT COMPANY] to reach a fair
> and satisfactory resolution.
>
> o   I feel proud to be a [CLIENT COMPANY] customer.
>
> o   [CLIENT COMPANY] always treats me with respect.
>
> o   [CLIENT COMPANY] is the perfect company/retailer for people like me.
>
> o   I can't imagine a world without [CLIENT COMPANY].
>
>
>
>
>
> Any help would be much appreciated. Thanks in advance.
>
>
>
>
>
>
>

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Engagement Index

Muir Houston-3
In reply to this post by Wayne Parker
I agree with Gene - and consider this worse (however you want to interpret that)  than the homework requests the list gets
 
 
Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699
 
R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/
 
THEMP: Tertiary Higher Education for People in Midlife

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Wayne Parker [[hidden email]]
Sent: 15 June 2012 06:55
To: [hidden email]
Subject: Engagement Index

While Sonia found Gene's tone rude, it was accurate - you've hired yourself out as an expert and don't have a clue how to do the project - I consider that unethical.

Sent from my iPhone

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: ENGAGEMENT INDEX

David Marso
Administrator
In reply to this post by Lorin Drake
"Hands-on, detailed instructions would be appreciated so that we can duplicate it in SPSS."
You want fries with that?
Get real!!!
----
Lorin Drake wrote
Good afternoon:



We have been asked to create an 'Engagement Index' for a client and, in all likelihood will be looking at the following questions in the form of an online survey to 1000+ respondents.



Can someone recommend the way they would create this index?

We have several approaches but are wondering if there are any 'best practices' out there.

We're an SPSS shop so ideally, we'd like to know how to conduct this analysis in SPSS.



Hands-on, detailed instructions would be appreciated so that we can duplicate it in SPSS.

Below is the Engagement battery.


Engagement

§  Overall, how satisfied are you with [CLIENT COMPANY]?

§  How likely are you to make another purchase from [CLIENT COMPANY]?

§  Why are you unlikely to purchase from [CLIENT COMPANY] again?

§  How likely are you to recommend [CLIENT COMPANY] to a friend or family member?

§  Why are you unlikely to recommend [CLIENT COMPANY] to a friend or family member?

§  Using a scale from 1 to 5, please tell us how much you agree or disagree with each of the following statements about [CLIENT COMPANY].

o   [CLIENT COMPANY] is a name I can always trust.

o   [CLIENT COMPANY] always delivers on what they promise.

o   [CLIENT COMPANY] always treats me fairly.

o   If a problem arises, I can always count on [CLIENT COMPANY] to reach a fair and satisfactory resolution.

o   I feel proud to be a [CLIENT COMPANY] customer.

o   [CLIENT COMPANY] always treats me with respect.

o   [CLIENT COMPANY] is the perfect company/retailer for people like me.

o   I can't imagine a world without [CLIENT COMPANY].





Any help would be much appreciated. Thanks in advance.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Engagement Index

Donna Carroll-2
In reply to this post by Muir Houston-3
<base href="x-msg://48/">I agree with Gene, as well.  

Donna Carroll, PhD



On Jun 15, 2012, at 6:10 AM, Muir Houston wrote:

I agree with Gene - and consider this worse (however you want to interpret that)  than the homework requests the list gets
 
 
Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699
 
R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/
 
THEMP: Tertiary Higher Education for People in Midlife

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Wayne Parker [[hidden email]]
Sent: 15 June 2012 06:55
To: [hidden email]
Subject: Engagement Index

While Sonia found Gene's tone rude, it was accurate - you've hired yourself out as an expert and don't have a clue how to do the project - I consider that unethical.

Sent from my iPhone

=====================
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

Reply | Threaded
Open this post in threaded view
|

Re: Engagement Index

David Marso
Administrator
In reply to this post by Wayne Parker
Maybe the "real" data analyst is on vacation and Sonia is a 'manager' who needs to crank the report out ;-)
OTOH, I too believe the approach to be 'unethical' How about them fries?...
-------------------------------------------------------------

Wayne Parker wrote
While Sonia found Gene's tone rude, it was accurate - you've hired yourself out as an expert and don't have a clue how to do the project - I consider that unethical.

Sent from my iPhone

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"