how to put files with different no. of variables together?

how to put files with different no. of variables together?

Post by Anonysu » Tue, 01 Jul 2003 22:56:12



Hello everybody,

got a little problem, maybe someone can help!?
I have a huge file containing about 150 different variables
and 200 cases. For further analyses, I got several other files
(different sources) with additional cases, but containing not all the
variables of my first, huge file. Some of the variables in that first
file (missing in the files to add) have been transformed or computed
out of other variables (e.g. filter variables).
Is there a simple way to put all the files together in one, which
adds the new cases AND computes the "missing" variables automatically?

Thanks a lot,

Susann.

--
Direct access to this group with http://web2news.com
http://web2news.com/?comp.soft-sys.stat.spss

 
 
 

how to put files with different no. of variables together?

Post by Michael Lac » Wed, 02 Jul 2003 02:25:59



> Hello everybody,
> got a little problem, maybe someone can help!?
> I have a huge file containing about 150 different variables
> and 200 cases.

Actually, this is not a huge file at all for SPSS to deal with.

Quote:>For further analyses, I got several other files
> (different sources) with additional cases, but containing not all the
> variables of my first, huge file. Some of the variables in that first
> file (missing in the files to add) have been transformed or computed
> out of other variables (e.g. filter variables).
> Is there a simple way to put all the files together in one, which
> adds the new cases AND computes the "missing" variables automatically?

You can Data-Merge Files-Add Cases to add the files together, but
there is now automatic way to get SPSS to create the "missing"
variables. (SPSS is not like Excel or other spreadsheets in
which the formulae for a variable is stored with the variable.)

The way to to this is to do your transformations via syntax,
or to save the syntax that is created when you do your
transformations via the menus.  Then, you can run that
syntax again to create the variables that are missing.
Unfortunately, I presume it is too late for that.
--
=-=-=-=-=-=-=-=-=-==-=-=-=
Mike Lacy,  Ft Collins CO 80523
voice (970) 491-6721      

 
 
 

how to put files with different no. of variables together?

Post by Anonysu » Wed, 02 Jul 2003 17:04:52




>> Hello everybody,

>> got a little problem, maybe someone can help!?
>> I have a huge file containing about 150 different variables
>> and 200 cases.
> Actually, this is not a huge file at all for SPSS to deal with.

I just meant "huge" in comparison to the other smaller ones.

Quote:>>For further analyses, I got several other files
>> (different sources) with additional cases, but containing
>> not all the
>> variables of my first, huge file. Some of the variables
>> in that first
>> file (missing in the files to add) have been transformed
>> or computed
>> out of other variables (e.g. filter variables).
>> Is there a simple way to put all the files together in one, which
>> adds the new cases AND computes the "missing" variables
>> automatically?

> You can Data-Merge Files-Add Cases to add the files together, but
> there is now automatic way to get SPSS to create the "missing"
> variables. (SPSS is not like Excel or other spreadsheets in
> which the formulae for a variable is stored with the variable.)

> The way to to this is to do your transformations via syntax,
> or to save the syntax that is created when you do your
> transformations via the menus.  Then, you can run that
> syntax again to create the variables that are missing.
> Unfortunately, I presume it is too late for that.

What does that mean? Is it impossible to put these files together??
)))-: ?????

Hm, I just wonder whether it would be possible to add the missing var.
to the "small" files first, and then add these files to the "huge" one?

Hoping for solution,

Susann.
--
Direct access to this group with http://web2news.com
http://web2news.com/?comp.soft-sys.stat.spss

 
 
 

how to put files with different no. of variables together?

Post by Arthur J. Kendal » Wed, 02 Jul 2003 19:50:52


There are several things you could do depending on the current situation.
Do you have the syntax from the earlier transformations and computes?
If so, you can apply it to the new cases.
Do you have the original input variables? If so you could save just the
original set of variables, merge the two sets, and do the transforms and
computes.
Did you write over variables from the original input?

Since you don't have a lot of data do you have the original source
documents?

It is good quality assuarance procedure in using SPSS to leave the menus
via <paste> rather than <ok>.  Some of the reasons to do this are: this
helps in applying the procedure to all of the the cases in the project,
in supporting review, in supporting the trial-and-error nature of
building an analysis, etc.

Hope this helps.

Art

Social Research Consultants
University Park, MD USA
(301) 864-5570




>>>Hello everybody,

>>>got a little problem, maybe someone can help!?
>>>I have a huge file containing about 150 different variables
>>>and 200 cases.

>>Actually, this is not a huge file at all for SPSS to deal with.

> I just meant "huge" in comparison to the other smaller ones.

>>>For further analyses, I got several other files
>>>(different sources) with additional cases, but containing
>>>not all the
>>>variables of my first, huge file. Some of the variables
>>>in that first
>>>file (missing in the files to add) have been transformed
>>>or computed
>>>out of other variables (e.g. filter variables).
>>>Is there a simple way to put all the files together in one, which
>>>adds the new cases AND computes the "missing" variables
>>>automatically?

>>You can Data-Merge Files-Add Cases to add the files together, but
>>there is now automatic way to get SPSS to create the "missing"
>>variables. (SPSS is not like Excel or other spreadsheets in
>>which the formulae for a variable is stored with the variable.)

>>The way to to this is to do your transformations via syntax,
>>or to save the syntax that is created when you do your
>>transformations via the menus.  Then, you can run that
>>syntax again to create the variables that are missing.
>>Unfortunately, I presume it is too late for that.

> What does that mean? Is it impossible to put these files together??
> )))-: ?????

> Hm, I just wonder whether it would be possible to add the missing var.
> to the "small" files first, and then add these files to the "huge" one?

> Hoping for solution,

> Susann.

 
 
 

how to put files with different no. of variables together?

Post by Anonysu » Wed, 02 Jul 2003 22:10:52



> There are several things you could do depending on the
> current situation.
> Do you have the syntax from the earlier transformations
> and computes?

I don't know if there is a syntax, where would that be? I always use
usual SPSS-menu commands!?

Quote:> If so, you can apply it to the new cases.
> Do you have the original input variables? If so you could
> save just the
> original set of variables, merge the two sets, and do the
> transforms and
> computes.
> Did you write over variables from the original input?

> Since you don't have a lot of data do you have the original source
> documents?

Think I need to explain a bit more: I did a study using several
questionnaires. Every question then is one variable in my dataset.
A few months ago, I did first analyses on a sample of n= 75.
I never changed or overwrote any original variables, always did further
analyses by new computed or filter variables.

As my sample has enlarged by additional cases now, I have to do
all the analyses again, but with the larger set of data.

These additional cases were collected in several separate files. Only
the first "big" file contains more than the original variables.
(E.g. I computed variables and scores like "if variable no.3 is > 10
and variable no.17 =0 then do NEW variable no.120 = 1")

Do I have to compute EVERYTHING completely new again?

Quote:

> It is good quality assuarance procedure in using SPSS to
> leave the menus
> via <paste> rather than <ok>.  Some of the reasons
> to do this are: this
> helps in applying the procedure to all of the the cases in
> the project,
> in supporting review, in supporting the trial-and-error nature of
> building an analysis, etc.

I'm not sure if my (not english!) version of SPSS contains thing like
that...

Quote:> Hope this helps.

Thanx a lot,

Susann.

--
Direct access to this group with http://web2news.com
http://web2news.com/?comp.soft-sys.stat.spss

 
 
 

how to put files with different no. of variables together?

Post by Bruce Weave » Wed, 02 Jul 2003 22:40:11




--- snip ----
>>It is good quality assuarance procedure in using SPSS to
>>leave the menus
>>via <paste> rather than <ok>.  Some of the reasons
>>to do this are: this
>>helps in applying the procedure to all of the the cases in
>>the project,
>>in supporting review, in supporting the trial-and-error nature of
>>building an analysis, etc.

> I'm not sure if my (not english!) version of SPSS contains thing like
> that...

>>Hope this helps.

> Thanx a lot,

> Susann.

Hi Susann,
   Here is an example of what Art is talking about:

* ---- start of syntax ------------------- .
* Demonstrate stacking files with add files.
* To run, open a syntax window in SPSS by
* clicking on File/New/Syntax. Then copy this
* syntax and paste it into that window.
* To run it, click on Run/All.

* Re Art Kendall's comment on PASTE:
* When using the pull-down menus, click on PASTE
* where you have been clicking on OKAY.
* This will cause SPSS to send syntax to a
* syntax file.  This is a good thing, because
* you can save your work in case you have to redo
* the analysis.

* First, create and save 2 "newer" files.

DATA LIST LIST / id q1 q2 q3 (4f2.0).
BEGIN DATA.
4 4 3 5
5 1 2 2
6 3 2 1
END DATA.

save outfile = 'c:\junk2.sav' /compressed.

DATA LIST LIST / id q1 q2 q3 (4f2.0).
BEGIN DATA.
7 5 3 2
8 4 4 5
END DATA.

save outfile = 'c:\junk3.sav' /compressed.

DATA LIST LIST / id q1 q2 q3 (4f2.0).
BEGIN DATA.
1 2 3 4
2 1 3 2
3 4 4 5
END DATA.

* Create a couple of new (computed) variables.

compute new1 = mean(q1 to q3).
compute new2 = max(q1 to q3).
exe.
format new1 new2 (f5.2).

* Now stack files junk2 and junk3.

add files file = *
  /file = 'c:\junk2.sav'
  /file = 'c:\junk3.sav'.
exe.

list all.

* Notice that variables NEW1 and NEW2 are missing for
* cases from the new files (junk2 and junk3).
* To obtain these values, I need to redo the
* computations that created them in the first file.

* Create a couple of new (computed) variables.
* If you have saved the syntax, just copy it here,
* and run again.  If you did not save the syntax,
* you have to reproduce all of the computations
* you did on the first file.

compute new1 = mean(q1 to q3).
compute new2 = max(q1 to q3).
exe.
list all.

* You might want to erase junk2.sav and junk3.sav from C:\.

new file.
erase file = 'c:\junk2.sav'.
erase file = 'c:\junk3.sav'.

* ---- end of syntax ------------------- .

Cheers,
Bruce
--
Bruce Weaver

www.angelfire.com/wv/bwhomedir/

 
 
 

how to put files with different no. of variables together?

Post by neci » Thu, 03 Jul 2003 03:21:07


Yes, you will have to "compute all the variables" over again after you get
all the files together.  Unless, when you first created them in the large
file you used the "Paste" button on the "Compute variable" dialog box to
save the syntax generated the first time you created all the new
variables.  Then you could just call up the syntax file, highlight the
whole thing, and run it.

If you didn't use the "Paste" button I suggest you do this next time you
create all the new variables just in case, in the future you want to add
more cases and then you could use the syntax file to get the new variables
for the new cases.
Cheers,


246 Computing Center            Web URL:http://www.acsu.buffalo.edu/~black
SUNY-Buffalo                    FAX:     (716) 645-3734
Buffalo, New York 14260         Phone:   (716) 645-3572



> > There are several things you could do depending on the
> > current situation.
> > Do you have the syntax from the earlier transformations
> > and computes?

> I don't know if there is a syntax, where would that be? I always use
> usual SPSS-menu commands!?

> > If so, you can apply it to the new cases.
> > Do you have the original input variables? If so you could
> > save just the
> > original set of variables, merge the two sets, and do the
> > transforms and
> > computes.
> > Did you write over variables from the original input?

> > Since you don't have a lot of data do you have the original source
> > documents?

> Think I need to explain a bit more: I did a study using several
> questionnaires. Every question then is one variable in my dataset.
> A few months ago, I did first analyses on a sample of n= 75.
> I never changed or overwrote any original variables, always did further
> analyses by new computed or filter variables.

> As my sample has enlarged by additional cases now, I have to do
> all the analyses again, but with the larger set of data.

> These additional cases were collected in several separate files. Only
> the first "big" file contains more than the original variables.
> (E.g. I computed variables and scores like "if variable no.3 is > 10
> and variable no.17 =0 then do NEW variable no.120 = 1")

> Do I have to compute EVERYTHING completely new again?

> > It is good quality assuarance procedure in using SPSS to
> > leave the menus
> > via <paste> rather than <ok>.  Some of the reasons
> > to do this are: this
> > helps in applying the procedure to all of the the cases in
> > the project,
> > in supporting review, in supporting the trial-and-error nature of
> > building an analysis, etc.

> I'm not sure if my (not english!) version of SPSS contains thing like
> that...

> > Hope this helps.

> Thanx a lot,

> Susann.

> --
> Direct access to this group with http://web2news.com
> http://web2news.com/?comp.soft-sys.stat.spss

 
 
 

how to put files with different no. of variables together?

Post by wadea7 » Thu, 03 Jul 2003 11:20:27


If you saved any of your output (standard viewer or draft viewer) from the
SPSS analyses, the syntax or commands you used at the time should be saved
within the log sections.  This helps you keep track of the operations you
ran in the past over the other data sets and will allow you to perform the
same commands over the new ones from a syntax window.  As the others have
suggested, once you get over the inital learning curve, the syntax is the
most efficient way to conduct analyses.

To merge separate files from the menu bar, select Data > Merge Files > Add
Cases and select the file you would like to add to the original.  You will
be asked which unmatched variables you would like to add (the ones that you
have previously run Compute statements on) and if you have been numbering
each case sequentially, you can indicated that variable as well.  If that
doesn't work, you will have to follow the procedures to create a new master
file from the existing ones and rerun the computations again.

Good luck,
A.Wade



> > There are several things you could do depending on the
> > current situation.
> > Do you have the syntax from the earlier transformations
> > and computes?

> I don't know if there is a syntax, where would that be? I always use
> usual SPSS-menu commands!?

> > If so, you can apply it to the new cases.
> > Do you have the original input variables? If so you could
> > save just the
> > original set of variables, merge the two sets, and do the
> > transforms and
> > computes.
> > Did you write over variables from the original input?

> > Since you don't have a lot of data do you have the original source
> > documents?

> Think I need to explain a bit more: I did a study using several
> questionnaires. Every question then is one variable in my dataset.
> A few months ago, I did first analyses on a sample of n= 75.
> I never changed or overwrote any original variables, always did further
> analyses by new computed or filter variables.

> As my sample has enlarged by additional cases now, I have to do
> all the analyses again, but with the larger set of data.

> These additional cases were collected in several separate files. Only
> the first "big" file contains more than the original variables.
> (E.g. I computed variables and scores like "if variable no.3 is > 10
> and variable no.17 =0 then do NEW variable no.120 = 1")

> Do I have to compute EVERYTHING completely new again?

> > It is good quality assuarance procedure in using SPSS to
> > leave the menus
> > via <paste> rather than <ok>.  Some of the reasons
> > to do this are: this
> > helps in applying the procedure to all of the the cases in
> > the project,
> > in supporting review, in supporting the trial-and-error nature of
> > building an analysis, etc.

> I'm not sure if my (not english!) version of SPSS contains thing like
> that...

> > Hope this helps.

> Thanx a lot,

> Susann.

> --
> Direct access to this group with http://web2news.com
> http://web2news.com/?comp.soft-sys.stat.spss

 
 
 

how to put files with different no. of variables together?

Post by Anonysu » Thu, 03 Jul 2003 15:49:02



> If you saved any of your output (standard viewer or draft
> viewer) from the
> SPSS analyses, the syntax or commands you used at the time
> should be saved
> within the log sections.  This helps you keep track of the
> operations you
> ran in the past over the other data sets and will allow
> you to perform the
> same commands over the new ones from a syntax window.  As
> the others have
> suggested, once you get over the inital learning curve,
> the syntax is the
> most efficient way to conduct analyses.

> To merge separate files from the menu bar, select Data >
> Merge Files > Add
> Cases and select the file you would like to add to the
> original.  You will
> be asked which unmatched variables you would like to add
> (the ones that you
> have previously run Compute statements on) and if you have
> been numbering
> each case sequentially, you can indicated that variable as
> well.  If that
> doesn't work, you will have to follow the procedures to
> create a new master
> file from the existing ones and rerun the computations again.

> Good luck,
> A.Wade

Ok, think I got it now! Even found that syntax file (didn't know
something like that is existing, but it does!!).

Thank you so much!

(-: (-: (-:

Susann.
--
Direct access to this group with http://web2news.com
http://web2news.com/?comp.soft-sys.stat.spss

 
 
 

1. "Put" will not put Macro variable

I have program that has the following:
%LET STUDY_YEAR = 2002;
...................
Later after doing a lot of things I produce the final file with
something like:
FILE OUT1;
   PUT
        Variable1         1-10
        Variable2        11-15
        ...........
        Variable20      13.2
        &STUDY_YEAR;

The output file has all the variables correct except that it ends
withVariable20.
The STUDY_YEAR is not there.
What am I doing wrong?
Thanks in advance,
- Alan

2. Series 5 : Message Suite : irDA

3. Can credentials from different realms be put in the same /tmp/krb5cc_<uid> file?

4. Complete Export of Group Policies to a flat text file

5. Putting different files/drawings on top of each other

6. SPEED question!!

7. Is it possible to start several syntax files together and run them together?

8. Help (Multiple files, different numbers of variables on each)

9. id variables in two different files

10. Putting together a no-name NS/I system

11. Trying to put together a NS/FIP Dell system

12. Wanted: your experiences putting together a Nexstep/Intel system