Looking for More Efficient Way to Stack Datasets

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

Looking for More Efficient Way to Stack Datasets

Feinstein, Zachary

The following code works but it is rather clumsy.  Can anyone suggest a better way to stack my data?  Even though the example below only does it three times my actual program does it a few dozen times.

 

Thank you.

 

Zachary

 

GET FILE = "G:\US\Minneapolis\General\TEAM1\Youth Query\analysis\data\36092_SPSS_Internal Loyalty_3-4-09.sav".

 

DATASET NAME original.

NEW FILE.

 

ADD FILES

 /FILE = original.

EXECUTE.

COMPUTE y_cat = 1.

EXECUTE.

 

ADD FILES

 /FILE = *

 /FILE = original.

EXECUTE.

RECODE y_cat (SYSMIS = 2).

EXECUTE.

 

ADD FILES

 /FILE = *

 /FILE = original.

EXECUTE.

RECODE y_cat (SYSMIS = 3).

EXECUTE.

Reply | Threaded
Open this post in threaded view
|

Re: Looking for More Efficient Way to Stack Datasets

Trejtowicz, Mariusz
Wiadomość
Hi Zachary,
 
Do you need to multiplicate the same file several times?
Maybe this will be helpfull:
 

 

GET FILE = "G:\US\Minneapolis\General\TEAM1\Youth Query\analysis\data\36092_SPSS_Internal Loyalty_3-4-09.sav".

DATASET NAME original.

add files
 /file = * /in=file1
 /file = original /in=file2
 /file = original /in=file3.
do repeat invar=file1 to file3 /code=1 to 3.
+ if invar=1 y_cat=code.
end repeat.
exe.
delete variables file1 to file3.

dataset name new.

 

 
Note however, that - If I remember it well - there is a limit of 50 files (/FILE lines) that can be added within one ADD FILES command.
 
Best regards,
Mariusz
 
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Feinstein, Zachary
Sent: Thursday, March 05, 2009 11:42 PM
To: [hidden email]
Subject: Looking for More Efficient Way to Stack Datasets

The following code works but it is rather clumsy.  Can anyone suggest a better way to stack my data?  Even though the example below only does it three times my actual program does it a few dozen times.

 

Thank you.

 

Zachary

 

GET FILE = "G:\US\Minneapolis\General\TEAM1\Youth Query\analysis\data\36092_SPSS_Internal Loyalty_3-4-09.sav".

 

DATASET NAME original.

NEW FILE.

 

ADD FILES

 /FILE = original.

EXECUTE.

COMPUTE y_cat = 1.

EXECUTE.

 

ADD FILES

 /FILE = *

 /FILE = original.

EXECUTE.

RECODE y_cat (SYSMIS = 2).

EXECUTE.

 

ADD FILES

 /FILE = *

 /FILE = original.

EXECUTE.

RECODE y_cat (SYSMIS = 3).

EXECUTE.