Compare Entries in Two Columns

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

Compare Entries in Two Columns

Chao Yawo
Hello,

i have a series of Data set up in two columns.  

Column A has a list of Names of Current Employees (text).
Column B has an extended list of names including former and current employees (text format)

I want a way to isolate/select/highlight the names of current employees (from Column A) that also appear in Column B. The goal is to delete the names of former employees so that both columns A and B have the names of current employees.

I would be very grateful for any pointers to program this.

cheers, Cy
Reply | Threaded
Open this post in threaded view
|

Re: Compare Entries in Two Columns

Art Kendall
Open a new instance of SPSS. Copy and paste the syntax below into a syntax window.  See if this is what you want.

new file.
data list list/current (a20) mixed(a20).
begin data
"john doe" "mary smith"
"Abel Baker" "John Doe"
"mary Smith" "George Washington"
"" "abel baker"
"" "abe lincoln"
"delta gamma" ""
end data.
dataset name input.
dataset copy tempa.
dataset activate tempa.
string name(a20).
compute name= upcase(current).
sort cases by name.
select if name ne lag(name).
execute.
dataset activate input.
dataset copy tempb.
dataset activate tempb.
string name(a20).
compute name= upcase(mixed).
sort cases by name.
select if name ne lag(name).
execute.
dataset declare newlist.
match files
 /file=tempa /in=  ina
 /file=tempb /in= inb
 /by name
 /keep name.
crosstabs tables = ina by inb.
list.



Art Kendall
Social Research Consultants



On 10/22/2010 1:50 PM, Chao Yawo wrote:
Hello,

i have a series of Data set up in two columns.  

Column A has a list of Names of Current Employees (text).
Column B has an extended list of names including former and current employees (text format)

I want a way to isolate/select/highlight the names of current employees (from Column A) that also appear in Column B. The goal is to delete the names of former employees so that both columns A and B have the names of current employees.

I would be very grateful for any pointers to program this.

cheers, Cy
===================== 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
Art Kendall
Social Research Consultants