Import values in a part of the cases

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

Import values in a part of the cases

Tom
Hi

 

The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.

 

It's probably a total different command I need...

 

Thanks for Help!

Tom

 
Reply | Threaded
Open this post in threaded view
|

Re: Import values in a part of the cases

Beadle, ViAnn
Have you looked at the UPDATE command?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom
Tom
Reply | Threaded
Open this post in threaded view
|

AW:Re: Import values in a part of the cases

Tom
Thanks - after getting the File A I tried with this Syntax ...

SORT CASES by Nachname Vorname.
UPDATE FILE=A
 / FILE=B
 / RENAME=(Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
 /by Nachname Vorname.

... receiving these errors:

>Error # 63 in column 13.  Text: A
>The file does not exist.
>This command not executed.

>Error # 63 in column 9.  Text: B
>The file does not exist.

>Note # 5146
>There is no working file to restore.  You must define a working file before
>proceeding with your analysis.

I got the A-file in the front window, so it does exist!


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Beadle, ViAnn
Gesendet: Freitag, 2. März 2007 14:50
An: [hidden email]
Betreff: Re: Import values in a part of the cases

Have you looked at the UPDATE command?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom
Reply | Threaded
Open this post in threaded view
|

Re: AW:Re: Import values in a part of the cases

Beadle, ViAnn
Did you provide a file handle command for your files. Otherwise, you have not specified them correctly.
It would really help if you give us your complete syntax, very hard to diagnose problems without it.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 8:50 AM
To: [hidden email]
Subject: AW:Re: Import values in a part of the cases

Thanks - after getting the File A I tried with this Syntax ...

SORT CASES by Nachname Vorname.
UPDATE FILE=A
 / FILE=B
 / RENAME=(Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
 /by Nachname Vorname.

... receiving these errors:

>Error # 63 in column 13.  Text: A
>The file does not exist.
>This command not executed.

>Error # 63 in column 9.  Text: B
>The file does not exist.

>Note # 5146
>There is no working file to restore.  You must define a working file before
>proceeding with your analysis.

I got the A-file in the front window, so it does exist!


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Beadle, ViAnn
Gesendet: Freitag, 2. März 2007 14:50
An: [hidden email]
Betreff: Re: Import values in a part of the cases

Have you looked at the UPDATE command?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom
Reply | Threaded
Open this post in threaded view
|

Re: Import values in a part of the cases

Melissa Ives
In reply to this post by Tom
You may want to use TABLE instead of UPDATE.  Look at the Operations of
each to see which one retains the records you want.  In TABLE, only
records that match in the FILE are included.  In UPDATE, new records are
created in the master file if they are in the update file but not in the
master.  I believe this means that they would work similarly IF you have
exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.
Tom
Reply | Threaded
Open this post in threaded view
|

AW: Re: AW:Re: Import values in a part of the cases

Tom
In reply to this post by Beadle, ViAnn
Here the complete Syntax:

*Getting the file with the values to update.
GET DATA  /TYPE = TXT
 /FILE = 'C:\...\B.txt'
 /DELCASE = LINE
 /DELIMITERS = "\t"
 /ARRANGEMENT = DELIMITED
 /FIRSTCASE = 2
 /IMPORTCASE = ALL
 /VARIABLES =
 Desig_PH F1.0
 Beginn F10.2
 Ende F10.2
 Name A20
 Vorname A12
 Titel A3
 Sex A1
 Str_Wohn A21
 PLZ F4.0
 Ort_Wohn A14
 Mail_g A33
 Funkt_1 A12
 Funkt_2 A31
 Funkt_3 A30
  .
CACHE.
EXECUTE.
DATASET NAME DatenSet5 WINDOW=FRONT.

SORT CASES by Name Vorname.

SAVE OUTFILE='C:\...\B1.sav'
 /COMPRESSED.

*Getting the file to update with the values from B1.
GET
  FILE='C:\...\A.sav'.
DATASET NAME DatenSet6 WINDOW=FRONT.

SORT CASES by Nachname Vorname.
UPDATE FILE = A
 / FILE = B1
 / RENAME = (Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
 /by Nachname Vorname.




-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Beadle, ViAnn
Gesendet: Freitag, 2. März 2007 16:06
An: [hidden email]
Betreff: Re: AW:Re: Import values in a part of the cases

Did you provide a file handle command for your files. Otherwise, you have not specified them correctly.
It would really help if you give us your complete syntax, very hard to diagnose problems without it.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 8:50 AM
To: [hidden email]
Subject: AW:Re: Import values in a part of the cases

Thanks - after getting the File A I tried with this Syntax ...

SORT CASES by Nachname Vorname.
UPDATE FILE=A
 / FILE=B
 / RENAME=(Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
 /by Nachname Vorname.

... receiving these errors:

>Error # 63 in column 13.  Text: A
>The file does not exist.
>This command not executed.

>Error # 63 in column 9.  Text: B
>The file does not exist.

>Note # 5146
>There is no working file to restore.  You must define a working file before
>proceeding with your analysis.

I got the A-file in the front window, so it does exist!


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Beadle, ViAnn
Gesendet: Freitag, 2. März 2007 14:50
An: [hidden email]
Betreff: Re: Import values in a part of the cases

Have you looked at the UPDATE command?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom
Tom
Reply | Threaded
Open this post in threaded view
|

AW: Re: Import values in a part of the cases

Tom
In reply to this post by Melissa Ives
Melissa, your suggestion sounds good. Yes, I want to have included only these cases that match my master file. I'd like to check out TABLE, but I can't find any COMMAND with this name in the Command Syntax Reference.



-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Melissa Ives
Gesendet: Freitag, 2. März 2007 16:30
An: [hidden email]
Betreff: Re: Import values in a part of the cases

You may want to use TABLE instead of UPDATE.  Look at the Operations of
each to see which one retains the records you want.  In TABLE, only
records that match in the FILE are included.  In UPDATE, new records are
created in the master file if they are in the update file but not in the
master.  I believe this means that they would work similarly IF you have
exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.
Reply | Threaded
Open this post in threaded view
|

Re: Import values in a part of the cases

Richard Ristow
At 10:44 AM 3/2/2007, Balmer Thomas wrote:

>Melissa, your suggestion sounds good. Yes, I want to have included
>only these cases that match my master file. I'd like to check out
>TABLE, but I can't find any COMMAND with this name in the Command
>Syntax Reference.

I think the reference is to the TABLE subcommand of the MATCH FILES
command.

In another question you've raised,

>*Getting the file to update with the values from B1.
>GET
>   FILE='C:\...\A.sav'.
>DATASET NAME DatenSet6 WINDOW=FRONT.
>
>SORT CASES by Nachname Vorname.
>UPDATE FILE = A
>  / FILE = B1
>  / RENAME = (Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
>  /by Nachname Vorname.
>
>>Error # 63 in column 13.  Text: A
>>The file does not exist.
>>This command not executed.
>
>>Error # 63 in column 9.  Text: B
>>The file does not exist.
>
>>Note # 5146
>>There is no working file to restore.  You must define a working file
>>before
>>proceeding with your analysis.
>
>I got the A-file in the front window, so it does exist!

First, although the file in the front window was LOADED from file A, it
isn't file A; it's a copy of it. Since it's the active file, you can
refer to it as '*'.

Second, you need to refer to file B1 the way you did when you saved it:
'C:\...\B1.sav'.

So your UPDATE command becomes

UPDATE FILE = *
  / FILE = 'C:\...\B1.sav'
  / RENAME = (Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
  /by Nachname Vorname.

That may do what you want. It assumes that,
- File B1 is also sorted by Nachname Vorname
- Neither file has more than one record for any combination of Nachname
Vorname

If the latter assumption is not correct, then it's time to think about
MATCH FILES with the TABLE subcommand.
Tom
Reply | Threaded
Open this post in threaded view
|

AW: Re: Import values in a part of the cases

Tom
>In another question you've raised,

>*Getting the file to update with the values from B1.
>GET
>   FILE='C:\...\A.sav'.
>DATASET NAME DatenSet6 WINDOW=FRONT.
>
>SORT CASES by Nachname Vorname.
>UPDATE FILE = A
>  / FILE = B1
>  / RENAME = (Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
>  /by Nachname Vorname.
>
>>Error # 63 in column 13.  Text: A
>>The file does not exist.
>>This command not executed.
>
>>Error # 63 in column 9.  Text: B
>>The file does not exist.
>
>>Note # 5146
>>There is no working file to restore.  You must define a working file
>>before
>>proceeding with your analysis.
>
>I got the A-file in the front window, so it does exist!

>First, although the file in the front window was LOADED from file A, it
>isn't file A; it's a copy of it. Since it's the active file, you can
>refer to it as '*'.

>Second, you need to refer to file B1 the way you did when you saved it:
>'C:\...\B1.sav'.

>So your UPDATE command becomes
>
>UPDATE FILE = *
>  / FILE = 'C:\...\B1.sav'
>  / RENAME = (Name, Str_Wohn, Mail_g=Nachname, Strasse, Email)
>  /by Nachname Vorname.

>That may do what you want. It assumes that,
>- File B1 is also sorted by Nachname Vorname
>- Neither file has more than one record for any combination of Nachname
>Vorname
>
>If the latter assumption is not correct, then it's time to think about
>MATCH FILES with the TABLE subcommand.

The UPDATE Command got the files now, but could not finish. It gave me
an error message with the first Nachname-Vorname-Combination which is
not unique - I suppose because of the point you mentioned: In File B1
Nachname and Vorname are unique combinations, but not so in File A. I'll
try the MACTCH FILES with TABLE.
Tom
Reply | Threaded
Open this post in threaded view
|

AW: Re: Import values in a part of the cases

Tom
In reply to this post by Melissa Ives
I tried the TABLE subcommand like this:

MATCH FILES /FILE=*
/TABLE='B1'
/RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse
/DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3 Sex
/BY Nachname Vorname.
EXE.

...renaming variables in the file B1 to match with the variables in the *-file (which is the master) and droping a few.
Strange Result: Nothing. The Syntax seems to work, because I got no error, but the values from B1 are not printed in the file *.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Melissa Ives
Gesendet: Freitag, 2. März 2007 16:30
An: [hidden email]
Betreff: Re: Import values in a part of the cases

You may want to use TABLE instead of UPDATE.  Look at the Operations of
each to see which one retains the records you want.  In TABLE, only
records that match in the FILE are included.  In UPDATE, new records are
created in the master file if they are in the update file but not in the
master.  I believe this means that they would work similarly IF you have
exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in
these cases, which match with the values of two variables (Firstname and
Name).

But the matching command seems to allow just two other purposes: to add
new variables or to add new cases.  I'd like to import just the values
in existing variables (Street, Town, Email) for the matching cases,
without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.
Reply | Threaded
Open this post in threaded view
|

Re: AW: Re: Import values in a part of the cases

Melissa Ives
In reply to this post by Tom
Thomas,

(As noted in my message to you on Fri 3/2/2007 11:28 AM) Remember that the order of the files matters, so IF the variables you want to add from the lookup table are already IN the main file, then the /TABLE= subcommand needs to come BEFORE the /FILE= subcommand.  (works the same way in regular match with 2 (or more) /FILE= statements) If a variable is common to both files, the one in the first listed file is what is retained.

So you would need to switch your file order in the MATCH command to be:
MATCH FILES
        /TABLE='B1'
        /FILE=*
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3    Sex /BY Nachname Vorname.
EXE.


Melissa
The bubbling brook would lose its song if you removed the rocks.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Monday, March 05, 2007 3:02 AM
To: [hidden email]
Subject: [SPSSX-L] AW: Re: Import values in a part of the cases

I tried the TABLE subcommand like this:

MATCH FILES /FILE=*
/TABLE='B1'
/RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3 Sex /BY Nachname Vorname.
EXE.

...renaming variables in the file B1 to match with the variables in the *-file (which is the master) and droping a few.
Strange Result: Nothing. The Syntax seems to work, because I got no error, but the values from B1 are not printed in the file *.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Melissa Ives
Gesendet: Freitag, 2. März 2007 16:30
An: [hidden email]
Betreff: Re: Import values in a part of the cases

You may want to use TABLE instead of UPDATE.  Look at the Operations of each to see which one retains the records you want.  In TABLE, only records that match in the FILE are included.  In UPDATE, new records are created in the master file if they are in the update file but not in the master.  I believe this means that they would work similarly IF you have exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in these cases, which match with the values of two variables (Firstname and Name).

But the matching command seems to allow just two other purposes: to add new variables or to add new cases.  I'd like to import just the values in existing variables (Street, Town, Email) for the matching cases, without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance.
Tom
Reply | Threaded
Open this post in threaded view
|

Re: AW: Re: Import values in a part of the cases

Tom
Thanks, Melissa, for your patience.

I've tried it now this way and got a new error: SPSS claims: Each case on a TABLE file in MATCH FILES must be uniquely identified by the by variables.

Thats probably not the case: In the A-File (*-File) are different cases with the same BY-variables Nachname and Vorname. They are unique only in the TABLE file. But thats exactly what Iwant: to put in the A-file by all these matching cases the values of different variables from the B-file (TABLE file). But first I have to rename the variables in the B-file in order to be the same as in the A-file. So I ended with this Syntax and the mentioned error:
MATCH FILES
        /TABLE='B1'
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse  
        /FILE=*
        /BY Nachname Vorname.
EXE.



-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion im Auftrag von Melissa Ives
Gesendet: Mo 05.03.2007 16:27
An: [hidden email]
Betreff:      Re: AW:      Re: Import values in a part of the cases
 
Thomas,

(As noted in my message to you on Fri 3/2/2007 11:28 AM) Remember that the order of the files matters, so IF the variables you want to add from the lookup table are already IN the main file, then the /TABLE= subcommand needs to come BEFORE the /FILE= subcommand.  (works the same way in regular match with 2 (or more) /FILE= statements) If a variable is common to both files, the one in the first listed file is what is retained.

So you would need to switch your file order in the MATCH command to be:
MATCH FILES
        /TABLE='B1'
        /FILE=*
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3    Sex /BY Nachname Vorname.
EXE.


Melissa
The bubbling brook would lose its song if you removed the rocks.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Monday, March 05, 2007 3:02 AM
To: [hidden email]
Subject: [SPSSX-L] AW: Re: Import values in a part of the cases

I tried the TABLE subcommand like this:

MATCH FILES /FILE=*
/TABLE='B1'
/RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3 Sex /BY Nachname Vorname.
EXE.

...renaming variables in the file B1 to match with the variables in the *-file (which is the master) and droping a few.
Strange Result: Nothing. The Syntax seems to work, because I got no error, but the values from B1 are not printed in the file *.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Melissa Ives
Gesendet: Freitag, 2. März 2007 16:30
An: [hidden email]
Betreff: Re: Import values in a part of the cases

You may want to use TABLE instead of UPDATE.  Look at the Operations of each to see which one retains the records you want.  In TABLE, only records that match in the FILE are included.  In UPDATE, new records are created in the master file if they are in the update file but not in the master.  I believe this means that they would work similarly IF you have exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in these cases, which match with the values of two variables (Firstname and Name).

But the matching command seems to allow just two other purposes: to add new variables or to add new cases.  I'd like to import just the values in existing variables (Street, Town, Email) for the matching cases, without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance.
Reply | Threaded
Open this post in threaded view
|

Re: AW: Re: Import values in a part of the cases

Melissa Ives
In reply to this post by Tom
Dear listers, to complete this thread, I am including my response to Thomas below. (Note that the syntax is untested).
Thomas, please note the small edit in the 4th line.

This error says that the records in your TABLE file has more than one record with the same Nachname and Vorname.

Try running the wizard for identifying duplicate cases on the Data menu.

Alternatively (if you don't have that option on the Data menu (I think it was added in V. 14) you could use the following syntax to get a list of the duplicate combination(s):

Sort cases by Nachname Vorname.
Compute dupeNN=0.
If (nachname=lag(nachname) and vorname=lag(vorname)) dupeNN=1.
Freq dupenn.

Temp.
Sel if dupenn=1.
List vars=nachname vorname (and any other variables you need to see to find the duplicates).

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Monday, March 05, 2007 12:45 PM
To: [hidden email]
Subject: Re: [SPSSX-L] AW: Re: Import values in a part of the cases

Thanks, Melissa, for your patience.

I've tried it now this way and got a new error: SPSS claims: Each case on a TABLE file in MATCH FILES must be uniquely identified by the by variables.

Thats probably not the case: In the A-File (*-File) are different cases with the same BY-variables Nachname and Vorname. They are unique only in the TABLE file. But thats exactly what Iwant: to put in the A-file by all these matching cases the values of different variables from the B-file (TABLE file). But first I have to rename the variables in the B-file in order to be the same as in the A-file. So I ended with this Syntax and the mentioned error:
MATCH FILES
        /TABLE='B1'
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse
        /FILE=*
        /BY Nachname Vorname.
EXE.



-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion im Auftrag von Melissa Ives
Gesendet: Mo 05.03.2007 16:27
An: [hidden email]
Betreff:      Re: AW:      Re: Import values in a part of the cases

Thomas,

(As noted in my message to you on Fri 3/2/2007 11:28 AM) Remember that the order of the files matters, so IF the variables you want to add from the lookup table are already IN the main file, then the /TABLE= subcommand needs to come BEFORE the /FILE= subcommand.  (works the same way in regular match with 2 (or more) /FILE= statements) If a variable is common to both files, the one in the first listed file is what is retained.

So you would need to switch your file order in the MATCH command to be:
MATCH FILES
        /TABLE='B1'
        /FILE=*
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3    Sex /BY Nachname Vorname.
EXE.


Melissa
The bubbling brook would lose its song if you removed the rocks.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Monday, March 05, 2007 3:02 AM
To: [hidden email]
Subject: [SPSSX-L] AW: Re: Import values in a part of the cases

I tried the TABLE subcommand like this:

MATCH FILES /FILE=*
/TABLE='B1'
/RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3 Sex /BY Nachname Vorname.
EXE.

...renaming variables in the file B1 to match with the variables in the *-file (which is the master) and droping a few.
Strange Result: Nothing. The Syntax seems to work, because I got no error, but the values from B1 are not printed in the file *.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Melissa Ives
Gesendet: Freitag, 2. März 2007 16:30
An: [hidden email]
Betreff: Re: Import values in a part of the cases

You may want to use TABLE instead of UPDATE.  Look at the Operations of each to see which one retains the records you want.  In TABLE, only records that match in the FILE are included.  In UPDATE, new records are created in the master file if they are in the update file but not in the master.  I believe this means that they would work similarly IF you have exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in these cases, which match with the values of two variables (Firstname and Name).

But the matching command seems to allow just two other purposes: to add new variables or to add new cases.  I'd like to import just the values in existing variables (Street, Town, Email) for the matching cases, without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance.
Tom
Reply | Threaded
Open this post in threaded view
|

AW: Re: AW: Re: Import values in a part of the cases

Tom
There hasn't been any duplicated cases in the TABLE file - except empty ones! I don't know why, but importing from an excel txt-file I'm getting allways thousands of empty cases.
Deleting them manually it works fine now! Thanky you very much!
Thomas

-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion im Auftrag von Melissa Ives
Gesendet: Mo 05.03.2007 20:15
An: [hidden email]
Betreff:      Re: AW: Re: Import values in a part of the cases
 
Dear listers, to complete this thread, I am including my response to Thomas below. (Note that the syntax is untested).
Thomas, please note the small edit in the 4th line.

This error says that the records in your TABLE file has more than one record with the same Nachname and Vorname.

Try running the wizard for identifying duplicate cases on the Data menu.

Alternatively (if you don't have that option on the Data menu (I think it was added in V. 14) you could use the following syntax to get a list of the duplicate combination(s):

Sort cases by Nachname Vorname.
Compute dupeNN=0.
If (nachname=lag(nachname) and vorname=lag(vorname)) dupeNN=1.
Freq dupenn.

Temp.
Sel if dupenn=1.
List vars=nachname vorname (and any other variables you need to see to find the duplicates).

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Monday, March 05, 2007 12:45 PM
To: [hidden email]
Subject: Re: [SPSSX-L] AW: Re: Import values in a part of the cases

Thanks, Melissa, for your patience.

I've tried it now this way and got a new error: SPSS claims: Each case on a TABLE file in MATCH FILES must be uniquely identified by the by variables.

Thats probably not the case: In the A-File (*-File) are different cases with the same BY-variables Nachname and Vorname. They are unique only in the TABLE file. But thats exactly what Iwant: to put in the A-file by all these matching cases the values of different variables from the B-file (TABLE file). But first I have to rename the variables in the B-file in order to be the same as in the A-file. So I ended with this Syntax and the mentioned error:
MATCH FILES
        /TABLE='B1'
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse
        /FILE=*
        /BY Nachname Vorname.
EXE.



-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion im Auftrag von Melissa Ives
Gesendet: Mo 05.03.2007 16:27
An: [hidden email]
Betreff:      Re: AW:      Re: Import values in a part of the cases

Thomas,

(As noted in my message to you on Fri 3/2/2007 11:28 AM) Remember that the order of the files matters, so IF the variables you want to add from the lookup table are already IN the main file, then the /TABLE= subcommand needs to come BEFORE the /FILE= subcommand.  (works the same way in regular match with 2 (or more) /FILE= statements) If a variable is common to both files, the one in the first listed file is what is retained.

So you would need to switch your file order in the MATCH command to be:
MATCH FILES
        /TABLE='B1'
        /FILE=*
        /RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3    Sex /BY Nachname Vorname.
EXE.


Melissa
The bubbling brook would lose its song if you removed the rocks.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Monday, March 05, 2007 3:02 AM
To: [hidden email]
Subject: [SPSSX-L] AW: Re: Import values in a part of the cases

I tried the TABLE subcommand like this:

MATCH FILES /FILE=*
/TABLE='B1'
/RENAME Name=Nachname Mail_g=Email Ort_Wohn=Ort Str_Wohn=Strasse /DROP= Beginn Desig_PH Ende Funkt_1 Funkt_2 Funkt_3 Sex /BY Nachname Vorname.
EXE.

...renaming variables in the file B1 to match with the variables in the *-file (which is the master) and droping a few.
Strange Result: Nothing. The Syntax seems to work, because I got no error, but the values from B1 are not printed in the file *.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Melissa Ives
Gesendet: Freitag, 2. März 2007 16:30
An: [hidden email]
Betreff: Re: Import values in a part of the cases

You may want to use TABLE instead of UPDATE.  Look at the Operations of each to see which one retains the records you want.  In TABLE, only records that match in the FILE are included.  In UPDATE, new records are created in the master file if they are in the update file but not in the master.  I believe this means that they would work similarly IF you have exactly the same records (per the matching variables) in both files.

Melissa
The bubbling brook would lose its song if you removed the rocks.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Friday, March 02, 2007 7:01 AM
To: [hidden email]
Subject: [SPSSX-L] Import values in a part of the cases

Hi



The aim would be to import values of a couple of string variables in these cases, which match with the values of two variables (Firstname and Name).

But the matching command seems to allow just two other purposes: to add new variables or to add new cases.  I'd like to import just the values in existing variables (Street, Town, Email) for the matching cases, without adding new variables or cases.



It's probably a total different command I need...



Thanks for Help!

Tom




PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance.