Computing new variables in specific places

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

Computing new variables in specific places

Eugenio Grant
Hi Guys:



I have a big DataBase,  It goes from V00001 to V10000. In order to conform
to a client's format I need to add 700 new variables (blanks1 to blanks700).



If I just compute the variables, SPSS will always compute them at the end,
but I need to put this spaces in particular parts of the database.



For example between V00733 and V00734 I need a blank, between V01003 and
V01004 I need a blank, and so on.



How can I tell SPSS where to put my new variables???



Thanks for your help.



Regards,
Reply | Threaded
Open this post in threaded view
|

Re:Computing new variables in specific places

Jerabek Jindrich
Hello,

You can change the order of your vars with any command that supports Keep parameter.

SAVE outfile = ... / Keep VarList .
or
MATCH FILES  /file=* / Keep VarList .
These commands will change the variables order according to the list behind keep.

If you had a template - I mean an emty data file, with no cases but with variables in correct order, you could use
ADD FILES
/file = TheEmptyFile
/file = YourDataFile.
This creates new data file with blank variables at the position they have in the empty file (even without computing blank variables).

regards
Jindra

> ------------ Původní zpráva ------------
> Od: Eugenio Grant <[hidden email]>
> Předmět: Computing new variables in specific places
> Datum: 01.12.2006 18:03:08
> ----------------------------------------
> Hi Guys:
>
>
>
> I have a big DataBase,  It goes from V00001 to V10000. In order to conform
> to a client's format I need to add 700 new variables (blanks1 to blanks700).
>
>
>
> If I just compute the variables, SPSS will always compute them at the end,
> but I need to put this spaces in particular parts of the database.
>
>
>
> For example between V00733 and V00734 I need a blank, between V01003 and
> V01004 I need a blank, and so on.
>
>
>
> How can I tell SPSS where to put my new variables???
>
>
>
> Thanks for your help.
>
>
>
> Regards,
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Computing new variables in specific places

Beadle, ViAnn
In reply to this post by Eugenio Grant
Look at KEEP on the Save command.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eugenio Grant
Sent: Friday, December 01, 2006 11:01 AM
To: [hidden email]
Subject: Computing new variables in specific places
Importance: High

Hi Guys:



I have a big DataBase,  It goes from V00001 to V10000. In order to conform
to a client's format I need to add 700 new variables (blanks1 to blanks700).



If I just compute the variables, SPSS will always compute them at the end,
but I need to put this spaces in particular parts of the database.



For example between V00733 and V00734 I need a blank, between V01003 and
V01004 I need a blank, and so on.



How can I tell SPSS where to put my new variables???



Thanks for your help.



Regards,
Reply | Threaded
Open this post in threaded view
|

Question about Rank procedure

Maguin, Eugene
In reply to this post by Eugenio Grant
All,

I was contemplating using the Rank procedure last night for something but
after reading and playing with an example, it seems to me that the command
functions in an unexpected manner. So probably I don't understand something.
Consider

RANK X1/NTILES(4) INTO Y1.

I read this to mean that I want to rank X1 into quartiles and save results
in Y1. Below is what the documentation says about the Ntiles(k) subcommand.

"NTILES(k)  Percentile groups. The new variable contains values from 1 to k,
where k is the number of groups to be generated. Each case is assigned a
group value, which is the integer part of 1+rk/(w+1), where r is the rank of
the case, k is the number of groups specified on NTILES, and w is the sum of
the case weights. Group values can be affected by the specification on TIES.
There is no default for k."

Consider a dataset of 12 cases with no cases having the same value and all
cases having unit weight. The rank values would be either from 1 to 12 or
from 0 to 11, depending on how the sorted values are numbered. Now consider
the formula, 1+rk/(w+1). Here, k = 4 and w = 12, since each case has equal
weight. Consider the following tables (font is courier new). Either of these
suggests to me that things are working as I would expect. Are my
expectations uncorrect? Or, is there something wrong in how I'm
understanding this procedure or the formula?  Thanks, Gene Maguin

         1-12 numbering                   0-11 numbering
      Computed      Expected           Computed      Expected
Rank  Quartile      Quartile     Rank  Quartile      Quartile
1     Trunc(5/13)=0     0        0     Trunc(1/13)=0     0
2     Trunc(9/13)=0     0        1     Trunc(4/13)=0     0
3     Trunc(13/13)=1    0        2     Trunc(9/13)=0     0
4     Trunc(17/13)=1    1        3     Trunc(13/13)=1    1
5     Trunc(21/13)=1    1        4     Trunc(17/13)=1    1
6     Trunc(25/13)=1    1        5     Trunc(21/13)=1    1
7     Trunc(29/13)=2    2        6     Trunc(25/13)=1    2
8     Trunc(33/13)=2    2        7     Trunc(29/13)=2    2
9     Trunc(37/13)=2    2        8     Trunc(33/13)=2    2
10    Trunc(41/13)=3    3        9     Trunc(37/13)=2    3
11    Trunc(45/13)=3    3        10    Trunc(41/13)=3    3
12    Trunc(49/13)=3    3        11    Trunc(45/13)=3    3