From String to String

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

From String to String

Jims More
A string variable has three to six words..  Actually such variable is name of schools where the values has word university or college.  Some other values have no words like university or college.  From such string variable, I would like to create another variable which classify whether a case is a university, college or niether a university nor a college.  Is this possible in SPSS?
 
Thankyou.
Jims


Chat right from the comfort of your inbox. Show me how..
Reply | Threaded
Open this post in threaded view
|

Re: From String to String

ViAnn Beadle

Yes, but you have to give us much more information such as the good examples of the string’s contents.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jims More
Sent: Saturday, May 09, 2009 9:36 AM
To: [hidden email]
Subject: From String to String

 

A string variable has three to six words..  Actually such variable is name of schools where the values has word university or college.  Some other values have no words like university or college.  From such string variable, I would like to create another variable which classify whether a case is a university, college or niether a university nor a college.  Is this possible in SPSS?

 

Thankyou.

Jims

 


Chat right from the comfort of your inbox. Show me how..

Reply | Threaded
Open this post in threaded view
|

Re: From String to String

Jims More
In reply to this post by Jims More
Hi ViAnn,
 
(I wrote:)

A string variable has three to six words..  Actually such variable is name of schools where the values has word university or college.  Some other values have no words like university or college.  From such string variable, I would like to create another variable which classify whether a case is a university, college or niether a university nor a college.  Is this possible in SPSS?

 Thankyou.

Jims

 
(You repkied)

Yes, but you have to give us much more information such as the good examples of the string’s contents.

 
Here is the example name_of_institution and Type_of_Institution as variables where Type_of_ institutionl is the target variable:
 
Name_of_institution                                     Type_of_Institution                   
California State University                             University
University of California                                  Universiy
Claremont McKenna College                         College
St Mary's College of California                       College
Western Institute for Social Research            neither a university nor a college
 
The first two institutions are classified as university because there is word "university" in the name.  The next two intitutions are classified as college because a word "college" is there in its name.  The last institution cannot be classified as a university or a college, hence, neither a university nor a college.
 
Hope this information is enough.
 
Thank you ViAnn.
Jims
 
 


--- On Sat, 9/5/09, ViAnn Beadle <[hidden email]> wrote:

From: ViAnn Beadle <[hidden email]>
Subject: Re: From String to String
To: [hidden email]
Received: Saturday, 9 May, 2009, 4:04 PM

Yes, but you have to give us much more information such as the good examples of the string’s contents.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jims More
Sent: Saturday, May 09, 2009 9:36 AM
To: [hidden email]
Subject: From String to String

 

A string variable has three to six words..  Actually such variable is name of schools where the values has word university or college.  Some other values have no words like university or college.  From such string variable, I would like to create another variable which classify whether a case is a university, college or niether a university nor a college.  Is this possible in SPSS?

 

Thankyou.

Jims

 


Chat right from the comfort of your inbox. Show me how..



Chat right from the comfort of your inbox. Show me how..
Reply | Threaded
Open this post in threaded view
|

Re: From String to String

ViAnn Beadle

Use the index function to find an occurrence of the string college or university.

 

data list / name (a40).

begin data

California State University

University of California

Claremont McKenna College

St Mary's College of California

Western Institute for Social Research

end data.

compute type=0.

if (index(upcase(name),'COLLEGE') > 0) type=1.

if (index(upcase(name),'UNIVERSITY')>0) type=2.

value labels type 1 "College" 2 "University".

list.

 

This example uppercases the entire string so there are no distinctions between University and UNIVERSITY. Note that this will fail with things like UC Berkeley, and UCLA and will classify University College London as a University. If I were you I would look at all type=0 instances to check for things like that.

 

Please take a look at all the string functions in HELP.

 

From: Jims More [mailto:[hidden email]]
Sent: Saturday, May 09, 2009 7:10 PM
To: [hidden email]; ViAnn Beadle
Subject: Re: From String to String

 

Hi ViAnn,

 

(I wrote:)

A string variable has three to six words..  Actually such variable is name of schools where the values has word university or college.  Some other values have no words like university or college.  From such string variable, I would like to create another variable which classify whether a case is a university, college or niether a university nor a college.  Is this possible in SPSS?

 Thankyou.

Jims

 

(You repkied)

Yes, but you have to give us much more information such as the good examples of the string’s contents.

 

Here is the example name_of_institution and Type_of_Institution as variables where Type_of_ institutionl is the target variable:

 

Name_of_institution                                     Type_of_Institution                   

California State University                             University

University of California                                  Universiy

Claremont McKenna College                         College

St Mary's College of California                       College

Western Institute for Social Research            neither a university nor a college

 

The first two institutions are classified as university because there is word "university" in the name.  The next two intitutions are classified as college because a word "college" is there in its name.  The last institution cannot be classified as a university or a college, hence, neither a university nor a college.

 

Hope this information is enough.

 

Thank you ViAnn.

Jims

 

 



--- On Sat, 9/5/09, ViAnn Beadle <[hidden email]> wrote:


From: ViAnn Beadle <[hidden email]>
Subject: Re: From String to String
To: [hidden email]
Received: Saturday, 9 May, 2009, 4:04 PM

Yes, but you have to give us much more information such as the good examples of the string’s contents.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jims More
Sent: Saturday, May 09, 2009 9:36 AM
To: [hidden email]
Subject: From String to String

 

A string variable has three to six words..  Actually such variable is name of schools where the values has word university or college.  Some other values have no words like university or college.  From such string variable, I would like to create another variable which classify whether a case is a university, college or niether a university nor a college.  Is this possible in SPSS?

 

Thankyou.

Jims

 


Chat right from the comfort of your inbox. Show me how..

 


Chat right from the comfort of your inbox. Show me how..