Re: Merge More Than One File At A Time

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

Re: Merge More Than One File At A Time

Hans Chen
Dear Listers

I have a main file which has 100 variables, and also I have 5 files. I just
wonder whether I can merge then at one time? Althorugh I know We can merge
them one file each time? Your suggestion will be highly appreciated.

Thanks!

======================
MATCH FILES /FILE=*
 /TABLE='C:\Documents and Settings\Hans\My Documents\FILE1.sav'
 /TABLE='C:\Documents and Settings\Hans\My Documents\FILE2.sav'
 /TABLE='C:\Documents and Settings\Hans\My Documents\FILE3.sav'
 /TABLE='C:\Documents and Settings\Hans\My Documents\FILE4.sav'
 /TABLE='C:\Documents and Settings\Hans\My Documents\FILE5.sav'
 /BY RESPNO.
EXECUTE.
--
Hans Chen
Canada

=====================
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: Merge More Than One File At A Time

Art Kendall
The documentation says that you can.
I cannot test this because I am moving to a newer PC and need to figure
out licenses.

However for version 16 <help> says (emphasis added)
says

MATCH FILES FILE={'savfile'|'dataset'}  *[TABLE={'savfile'|'dataset'}]   *
                 {*                  }         {*                  }

 [/RENAME=(old varnames=new varnames)...]

 [/IN=varname]

 /FILE=...  *[TABLE= ...]*

 [/BY varlist]

 [/MAP]

 [/KEEP={ALL**  }] [/DROP=varlist]
        {varlist}

 [/FIRST=varname]  [/LAST=varname]

the version 9 manual says: (emphasis added)
A separate TABLE command must be used to specify *each *lookup file . . ..

Art Kendall
Social Research Consultants

Hans Chen wrote:

> Dear Listers
>
> I have a main file which has 100 variables, and also I have 5 files. I just
> wonder whether I can merge then at one time? Althorugh I know We can merge
> them one file each time? Your suggestion will be highly appreciated.
>
> Thanks!
>
> ======================
> MATCH FILES /FILE=*
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE1.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE2.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE3.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE4.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE5.sav'
>  /BY RESPNO.
> EXECUTE.
> --
> Hans Chen
> Canada
>
> =====================
> 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
>
>
>

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

Re: Merge More Than One File At A Time

Dennis Deck
In reply to this post by Hans Chen
Hans, your example should work fine.
Let me just add that you want to make sure that:
 1) each table is sorted on the key variable(s)
 2) each /Table has only one record per case
 3) make sure your key variable(s) in each file is defined the same
    (eg, if it is a string, make sure it is the same length in each
file)

Syntax examples:

* join related tables to a master file .
MATCH FILES
   File=  *
  /Table= 'Table1.sav'
  /Table= 'Table2.sav'
    /By= ID /Map .

* if you have already read and named files using DATASET NAME  .
MATCH FILES
   File=  *
  /Table= Table1
  /Table= Table2
    /By= ID .

* determine if all records were matched (Linked is 0 if no match, 1 if
matched) .
MATCH FILES
   File=  Student
  /Table= School /IN= Linked
    /By= StudentID Year  /Map .

FREQUENCES Vars= Linked .


Dennis Deck, PhD
RMC Research Corporation
111 SW Columbia Street, Suite 1200
Portland, Oregon 97201-5843
voice: 503-223-8248 x715
voice: 800-788-1887 x715
fax:  503-223-8248
[hidden email]


-----Original Message-----
From: Art Kendall [mailto:[hidden email]]
Sent: Saturday, April 05, 2008 5:49 AM
Subject: Re: Merge More Than One File At A Time

The documentation says that you can.
I cannot test this because I am moving to a newer PC and need to figure
out licenses.

However for version 16 <help> says (emphasis added) says

MATCH FILES FILE={'savfile'|'dataset'}  *[TABLE={'savfile'|'dataset'}]
*
                 {*                  }         {*                  }

 [/RENAME=(old varnames=new varnames)...]

 [/IN=varname]

 /FILE=...  *[TABLE= ...]*

 [/BY varlist]

 [/MAP]

 [/KEEP={ALL**  }] [/DROP=varlist]
        {varlist}

 [/FIRST=varname]  [/LAST=varname]

the version 9 manual says: (emphasis added) A separate TABLE command
must be used to specify *each *lookup file . . ..

Art Kendall
Social Research Consultants

Hans Chen wrote:
> Dear Listers
>
> I have a main file which has 100 variables, and also I have 5 files. I

> just wonder whether I can merge then at one time? Althorugh I know We
> can merge them one file each time? Your suggestion will be highly
appreciated.

>
> Thanks!
>
> ======================
> MATCH FILES /FILE=*
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE1.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE2.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE3.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE4.sav'
>  /TABLE='C:\Documents and Settings\Hans\My Documents\FILE5.sav'
>  /BY RESPNO.
> EXECUTE.
> --
> Hans Chen
> Canada
>
> =====================
> 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
>
>
>

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