Merging several nominal variables into one new variable

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

Merging several nominal variables into one new variable

Anders Pedersen
Dear Listers,
 
I have merged three datasets in SPSS 19 using MATCH FILES:
DATASET ACTIVATE DataSet1.
MATCH FILES /FILE=*
  /FILE='DataSet3'
  /RENAME (ID = d0)
  /IN source01
  /BY CreatedBy
  /DROP= d0.
 
All three data sets consist of survey questionaires and include similar background questions like age, gender, nationality etc., but located in three different variables (column) in the merged data set. 
 
I am therefore now faced with several similar variables, located in different variables alocated such as this:
 
From Dataset1: Country - located in variable#12 in the merged data set
From Dataset2: Country - located in variable#25 in the merged data set
From Dataset3: Country - located in variable#37 in the merged data set
 
1) How can I possibly merge these variables into one new variable comprising nationality of (nominal)?
 
2) Most likely each CASE, in the new merged variable, will hold only one value. However multiple entries can occur - thus, how do I discriminate between nominal variable values (ie. countries)?
 
Any advice will be highly appreciated!
 
Thanks,
Anders 
 
______
Anders Pedersen 
Analyst and data journalist
Den Haag
The Netherlands
Reply | Threaded
Open this post in threaded view
|

Re: Merging several nominal variables into one new variable

John F Hall

Anders

 

What are your three variables called in the new file?  Can you send an extract of the data to let us know what the file looks like?

 

 

John F Hall

 

[hidden email]

www.surveyresearch.weebly.com

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Anders Pedersen
Sent: 16 August 2011 09:42
To: [hidden email]
Subject: Merging several nominal variables into one new variable

 

Dear Listers,

 

I have merged three datasets in SPSS 19 using MATCH FILES:

DATASET ACTIVATE DataSet1.
MATCH FILES /FILE=*
  /FILE='DataSet3'
  /RENAME (ID = d0)
  /IN source01
  /BY CreatedBy
  /DROP= d0.

 

All three data sets consist of survey questionaires and include similar background questions like age, gender, nationality etc., but located in three different variables (column) in the merged data set. 

 

I am therefore now faced with several similar variables, located in different variables alocated such as this:

 

From Dataset1: Country - located in variable#12 in the merged data set

From Dataset2: Country - located in variable#25 in the merged data set

From Dataset3: Country - located in variable#37 in the merged data set

 

1) How can I possibly merge these variables into one new variable comprising nationality of (nominal)?

 

2) Most likely each CASE, in the new merged variable, will hold only one value. However multiple entries can occur - thus, how do I discriminate between nominal variable values (ie. countries)?

 

Any advice will be highly appreciated!

 

Thanks,

Anders 

 

______

Anders Pedersen 

Analyst and data journalist

Den Haag

The Netherlands

Reply | Threaded
Open this post in threaded view
|

Re: Merging several nominal variables into one new variable

Maguin, Eugene
In reply to this post by Anders Pedersen
Anders,
 
Please post some example data and show how you want the data to look afterwards. Even though your question seems absolutely simple, it doesn't. By the way, what is a data journalist?

Gene Maguin 
 
 
 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Anders Pedersen
Sent: Tuesday, August 16, 2011 3:42 AM
To: [hidden email]
Subject: Merging several nominal variables into one new variable

Dear Listers,
 
I have merged three datasets in SPSS 19 using MATCH FILES:
DATASET ACTIVATE DataSet1.
MATCH FILES /FILE=*
  /FILE='DataSet3'
  /RENAME (ID = d0)
  /IN source01
  /BY CreatedBy
  /DROP= d0.
 
All three data sets consist of survey questionaires and include similar background questions like age, gender, nationality etc., but located in three different variables (column) in the merged data set. 
 
I am therefore now faced with several similar variables, located in different variables alocated such as this:
 
From Dataset1: Country - located in variable#12 in the merged data set
From Dataset2: Country - located in variable#25 in the merged data set
From Dataset3: Country - located in variable#37 in the merged data set
 
1) How can I possibly merge these variables into one new variable comprising nationality of (nominal)?
 
2) Most likely each CASE, in the new merged variable, will hold only one value. However multiple entries can occur - thus, how do I discriminate between nominal variable values (ie. countries)?
 
Any advice will be highly appreciated!
 
Thanks,
Anders 
 
______
Anders Pedersen 
Analyst and data journalist
Den Haag
The Netherlands
Reply | Threaded
Open this post in threaded view
|

Re: Merging several nominal variables into one new variable

David Marso
Administrator
In reply to this post by Anders Pedersen
>1) How can I possibly merge these variables into one new variable comprising
>nationality of (nominal)?
---
Aiming low with my shotgun:
COMPUTE Country=MAX(variable#12,variable#25,variable#37).

>2a) Most likely each CASE, in the new merged variable, will hold only one value.
ALL IS WELL!!! REJOICE!!!

>2b) However multiple entries can occur - thus, how do I discriminate between nominal variable values (ie. countries)?

Hmmm, so what should this mystery field look like?  Is this due to bad data?  Fat fingered data entry people?,  Cases of mistaken identity?  You'll need to make some decisions, prioritize...Meanwhile, post an example with how you would wish it resolved and maybe we can pull a dirty magical rabbit out of our hat.

Anders Pedersen wrote
Dear Listers,

I have merged three datasets in SPSS 19 using MATCH FILES:
DATASET ACTIVATE DataSet1.
MATCH FILES /FILE=*
  /FILE='DataSet3'
  /RENAME (ID = d0)
  /IN source01
  /BY CreatedBy
  /DROP= d0.

All three data sets consist of survey questionaires and include similar
background questions like age, gender, nationality etc., but located in
three different variables (column) in the merged data set.

I am therefore now faced with several similar variables, located in
different variables alocated such as this:

From Dataset1: Country - located in variable#12 in the merged data set
 From Dataset2: Country - located in variable#25 in the merged data set
 From Dataset3: Country - located in variable#37 in the merged data set

1) How can I possibly merge these variables into one new variable comprising
nationality of (nominal)?

2) Most likely each CASE, in the new merged variable, will hold only one
value. However multiple entries can occur - thus, how do I discriminate
between nominal variable values (ie. countries)?

Any advice will be highly appreciated!

Thanks,
Anders

______
Anders Pedersen
Analyst and data journalist
Den Haag
The Netherlands
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: Merging several nominal variables into one new variable

news
In reply to this post by Anders Pedersen
Anders,
if I understand well you want to have a single variable country in the
final file. So  you should rename the variable that represents the
country items in the original files with an identical name, and recode -
if necessary - the items so that you always get the same codes.

I hope I understood your problem.
Regards,
Dr Frank Thomas
FTR Internet Research
Rosny-sous-Bois
France

On 16/08/2011 09:42, Anders Pedersen wrote:

> Dear Listers,
> I have merged three datasets in SPSS 19 using MATCH FILES:
> DATASET ACTIVATE DataSet1.
> MATCH FILES /FILE=*
>    /FILE='DataSet3'
>    /RENAME (ID = d0)
>    /IN source01
>    /BY CreatedBy
>    /DROP= d0.
> All three data sets consist of survey questionaires and include similar
> background questions like age, gender, nationality etc., but located in
> three different variables (column) in the merged data set.
> I am therefore now faced with several similar variables, located in
> different variables alocated such as this:
>  From Dataset1: Country - located in variable#12 in the merged data set
>  From Dataset2: Country - located in variable#25 in the merged data set
>  From Dataset3: Country - located in variable#37 in the merged data set
> 1) How can I possibly merge these variables into one new variable
> comprising nationality of (nominal)?
> 2) Most likely each CASE, in the new merged variable, will hold only one
> value. However multiple entries can occur - thus, how do I discriminate
> between nominal variable values (ie. countries)?
> Any advice will be highly appreciated!
> Thanks,
> Anders
> ______
> Anders Pedersen
> Analyst and data journalist
> Den Haag
> The Netherlands

=====================
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: Merging several nominal variables into one new variable

hillel vardi
In reply to this post by Anders Pedersen
  Shalom

One way to merge your data is by using add files and aggregate

Here is a general example .

Get  file = DataSet1 keep=id var12 all .
dataset name  DataSet1

* use rename to rename dataset2 var25 to var12 as in dataset1 .

Get  file = DataSet2 /rename (var25 .....  all other variables  = var12
....  all other variables ) .
dataset name  DataSet2 .
Get  file = DataSet3 /rename (var37 .....  all other variables  = var12
....  all other variables ) .
dataset name  DataSet3 .
add files  file= DataSet1 /file= DataSet2 / file= DataSet3 .
aggregate   file=* / break = id / var12 ....  all other variables
=max(var12 ....  all other variables)
                   / nvar12=n(var12) .


If some of the datasets have unique data you suould rename them to a
unique new vriable .
The syntax above will generate one value for each variable  as sex age
ect can have only one value per case ,
  but you can count how many values there were in the 3 datasets  .

Hillel Vardi
BGU

On 16/08/2011 10:42, Anders Pedersen wrote:

> Dear Listers,
> I have merged three datasets in SPSS 19 using MATCH FILES:
> DATASET ACTIVATE DataSet1.
> MATCH FILES /FILE=*
>   /FILE='DataSet3'
>   /RENAME (ID = d0)
>   /IN source01
>   /BY CreatedBy
>   /DROP= d0.
> All three data sets consist of survey questionaires and include
> similar background questions like age, gender, nationality etc.,
> but located in three different variables (column) in the merged data set.
> I am therefore now faced with several similar variables, located in
> different variables alocated such as this:
> From Dataset1: Country - located in variable#12 in the merged data set
> From Dataset2: Country - located in variable#25 in the merged data set
> From Dataset3: Country - located in variable#37 in the merged data set
> 1) How can I possibly merge these variables into one new variable
> comprising nationality of (nominal)?
> 2) Most likely each CASE, in the new merged variable, will hold only
> one value. However multiple entries can occur - thus, how do I
> discriminate between nominal variable values (ie. countries)?
> Any advice will be highly appreciated!
> Thanks,
> Anders
> ______
> Anders Pedersen
> Analyst and data journalist
> Den Haag
> The Netherlands

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