Geometric codification in SPSS 16

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

Geometric codification in SPSS 16

Jean Gabriel TOUGMA
Hello,

I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8, 16.
If there are many products cultivated, we add the codes together and we can
have codes from 0 to 31.  In French, it is called geometric codification.

Is there a command, in spss 16,  to decompose this variable to dummy
variables according to each codes from 0 to 31?

Thanks for your response.

 

_____________________________________________________

TOUGMA Jean Gabriel

Ingénieur Statisticien Economiste

Tel : (226) 50 32 42 02 / 70 44 35 81

_____________________________________________________

Ne vous souciez pas d'être meilleur que vos contemporains ou vos
prédécesseurs, occupez-vous d'être meilleur que vous-même.

 

====================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: Geometric codification in SPSS 16

Maguin, Eugene
Jean,

Yes, that's a clever method of compactly collapsing the values of multiple
dichotomous variables. I think: Y = sum(x(i)*2**(i-1)), where x(i) is the
value of x(1) thru x(5).

There's not a command that I know of. There may be something written in
Python or script. Others will know more about this than I do. I think you'll
have to extract category values by recursively extracting the powers of 2.

Gene Maguin

>>I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8,
16.
If there are many products cultivated, we add the codes together and we can
have codes from 0 to 31.  In French, it is called geometric codification.

Is there a command, in spss 16,  to decompose this variable to dummy
variables according to each codes from 0 to 31?

Thanks for your response.



_____________________________________________________

TOUGMA Jean Gabriel

Ingénieur Statisticien Economiste

Tel : (226) 50 32 42 02 / 70 44 35 81

_____________________________________________________

Ne vous souciez pas d'être meilleur que vos contemporains ou vos
prédécesseurs, occupez-vous d'être meilleur que vous-même.



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

Re: Geometric codification in SPSS 16

John F Hall
Gene
 
Je demeure en France et je sais bien lire et écrire français, mais il me manque peut-être quelques mots techniques.
 
I take it the original variables were never coded, but added together before entering a single code?
 
You basically need to generate five new variables by decomposing the geometric sum.  I've done some pretty complex SPSS jobs before, but this one could be fun.  Thinking while I'm doing it, but some kind of do if...else if... loop might come in handy.
 
You need to initiate five blank dummies, say d1, d 2, d4, d8, d16 depending on the value 1 to 31 of your geometric variable.
 
This table may help
 
geom d1 d2 d4 d8 d16
1 1 0 0 0 0
2 0 1 0 0 0
3 1 1 0 0 0
4 0 0 1 0 0
5 1 0 1 0 0
6 0 1 1 0 0
7 1 1 1 0 0
8 0 0 0 0 0
9 1 0 0 1 0
10 0 1 0 1 0
11 1 1 0 1 0
12 0 0 1 1 0
13 1 0 1 1 0
14 0 1 1 1 0
15 1 1 1 1 0
16 0 0 0 0 1
17 1 0 0 0 1
18 0 1 0 0 1
19 1 1 0 0 1
20 0 0 1 0 1
21 1 0 1 0 1
22 0 1 1 0 1
23 1 1 1 0 1
24 0 0 0 1 1
25 1 0 0 1 1
26 0 1 0 1 1
27 1 1 0 1 1
27 0 0 1 1 1
29 1 0 1 1 1
30 0 1 1 1 1
31 1 1 1 1
1
This is where it could get complicated!  It's more than 30 years since I did anythinglike this, but would something like the following work?  With all these conditional statements it would have taken forever in the old days, but could be a bit quicker today
 
do repeat
x= d1 d2 d4 d8 d16 d32
compute x=0
end repeat
 
do if                 geom = 1
compute           d1 =1
else if             geom = 2
compute            d2 =1
else if             geom = 3
compute         d1 =1
compute         d2 = 1
else if             geom =4
compute        d4 = 1
 
etc.......
 
Another quicker possibility (using the above table) might be:
 
recode geom
    (1=10000)(2=1000)(3=11000)(4=100)(5=10100)(6=1100)
    (7=11100)(8=10)(9=10010)
    ~
    ~
    (30=1111)(31=11111)
    into dummy.
 
do repeat
x = d1 d2 d4 d8 d16
compute x = dummy
end repeat
 
recode d1 (10000 11000 10100 11100 10010 11010 11110 10001 11001 11101 11111 =1)
             d2 (01000 01010 11000 01100 11010 11100  01110 11010 11110 11001  11111 =2)
 
etc.
etc.
 
Ça me fait mal aux yeux: à vous de compléter!
 
John Hall
 
 
----- Original Message -----
Sent: Tuesday, September 15, 2009 4:45 PM
Subject: Re: Geometric codification in SPSS 16


Jean,

Yes, that's a clever method of compactly collapsing the values of multiple
dichotomous variables. I think: Y = sum(x(i)*2**(i-1)), where x(i) is the
value of x(1) thru x(5).

There's not a command that I know of. There may be something written in
Python or script. Others will know more about this than I do. I think you'll
have to extract category values by recursively extracting the powers of 2.

Gene Maguin

>>I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8,
16.
If there are many products cultivated, we add the codes together and we can
have codes from 0 to 31.  In French, it is called geometric codification.

Is there a command, in spss 16,  to decompose this variable to dummy
variables according to each codes from 0 to 31?

Thanks for your response.



_____________________________________________________

TOUGMA Jean Gabriel

Ingénieur Statisticien Economiste

Tel : (226) 50 32 42 02 / 70 44 35 81

_____________________________________________________

Ne vous souciez pas d'être meilleur que vos contemporains ou vos
prédécesseurs, occupez-vous d'être meilleur que vous-même.



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

Reply | Threaded
Open this post in threaded view
|

Re: Geometric codification in SPSS 16

Bruce Weaver
Administrator
If I follow, this is just about converting decimal to binary, is it not?  Here are some instructions on how to do that:

    http://www.wikihow.com/Convert-from-Decimal-to-Binary

And here is my attempt to convert those instructions into syntax.  I think I end up with the same table John had.


new file.
input program.
loop #i = 0 to 31.
 compute x = #i.
 end case.
end loop.
end file.
end input program.
exe.

numeric d1 d2 d4 d8 d16 (f1.0).
exe.

compute #temp = x.
compute d16 = (#temp GE 16).
if d16 #temp = #temp - 16 .
compute d8 = (#temp GE 8).
if d8 #temp = #temp - 8.
compute d4 = (#temp GE 4).
if d4 #temp = #temp - 4.
compute d2 = (#temp GE 2).
if d2 #temp = #temp - 2.
compute d1 = (#temp GE 1).
list.


John F Hall-2 wrote
Gene

Je demeure en France et je sais bien lire et écrire français, mais il me manque peut-être quelques mots techniques.

I take it the original variables were never coded, but added together before entering a single code?

You basically need to generate five new variables by decomposing the geometric sum.  I've done some pretty complex SPSS jobs before, but this one could be fun.  Thinking while I'm doing it, but some kind of do if...else if... loop might come in handy.

You need to initiate five blank dummies, say d1, d 2, d4, d8, d16 depending on the value 1 to 31 of your geometric variable.

This table may help

        geom d1 d2 d4 d8 d16
           
        1 1 0 0 0 0
        2 0 1 0 0 0
        3 1 1 0 0 0
        4 0 0 1 0 0
        5 1 0 1 0 0
        6 0 1 1 0 0
        7 1 1 1 0 0
        8 0 0 0 0 0
        9 1 0 0 1 0
        10 0 1 0 1 0
        11 1 1 0 1 0
        12 0 0 1 1 0
        13 1 0 1 1 0
        14 0 1 1 1 0
        15 1 1 1 1 0
        16 0 0 0 0 1
        17 1 0 0 0 1
        18 0 1 0 0 1
        19 1 1 0 0 1
        20 0 0 1 0 1
        21 1 0 1 0 1
        22 0 1 1 0 1
        23 1 1 1 0 1
        24 0 0 0 1 1
        25 1 0 0 1 1
        26 0 1 0 1 1
        27 1 1 0 1 1
        27 0 0 1 1 1
        29 1 0 1 1 1
        30 0 1 1 1 1
        31 1 1 1 1 1

This is where it could get complicated!  It's more than 30 years since I did anythinglike this, but would something like the following work?  With all these conditional statements it would have taken forever in the old days, but could be a bit quicker today

do repeat
x= d1 d2 d4 d8 d16 d32
compute x=0
end repeat

do if                 geom = 1
compute            d1 =1
else if             geom = 2
compute            d2 =1
else if             geom = 3
compute         d1 =1
compute         d2 = 1
else if             geom =4
compute        d4 = 1

etc.......

Another quicker possibility (using the above table) might be:

recode geom
    (1=10000)(2=1000)(3=11000)(4=100)(5=10100)(6=1100)
    (7=11100)(8=10)(9=10010)
    ~
    ~
    (30=1111)(31=11111)
    into dummy.

do repeat
x = d1 d2 d4 d8 d16
compute x = dummy
end repeat

recode d1 (10000 11000 10100 11100 10010 11010 11110 10001 11001 11101 11111 =1)
             d2 (01000 01010 11000 01100 11010 11100  01110 11010 11110 11001  11111 =2)

etc.
etc.

Ça me fait mal aux yeux: à vous de compléter!

John Hall


  ----- Original Message -----
  From: Gene Maguin
  To: SPSSX-L@LISTSERV.UGA.EDU
  Sent: Tuesday, September 15, 2009 4:45 PM
  Subject: Re: Geometric codification in SPSS 16



  Jean,

  Yes, that's a clever method of compactly collapsing the values of multiple
  dichotomous variables. I think: Y = sum(x(i)*2**(i-1)), where x(i) is the
  value of x(1) thru x(5).

  There's not a command that I know of. There may be something written in
  Python or script. Others will know more about this than I do. I think you'll
  have to extract category values by recursively extracting the powers of 2.

  Gene Maguin

  >>I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8,
  16.
  If there are many products cultivated, we add the codes together and we can
  have codes from 0 to 31.  In French, it is called geometric codification.

  Is there a command, in spss 16,  to decompose this variable to dummy
  variables according to each codes from 0 to 31?

  Thanks for your response.



  _____________________________________________________

  TOUGMA Jean Gabriel

  Ingénieur Statisticien Economiste

  Tel : (226) 50 32 42 02 / 70 44 35 81

  _____________________________________________________

  Ne vous souciez pas d'être meilleur que vos contemporains ou vos
  prédécesseurs, occupez-vous d'être meilleur que vous-même.



  =======
  To manage your subscription to SPSSX-L, send a message to
  LISTSERV@LISTSERV.UGA.EDU (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
  LISTSERV@LISTSERV.UGA.EDU (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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Geometric codification in SPSS 16

John F Hall

Bruce
 
40 years ago I could probably have done this in Algol.  The logic must come from all that Latin and Greek I did before switching to survey research..
 
Nice hyperlink to tutorial: even sociologists might understand it.
 
Translation from my French.

I live in France and can read and write French, but I may be short of a few technical terms.
...
This is doing my head in: up to you to complete it!

Sent it to Guy Maguin by mistake: he couldn't translate all of  it.  Sent it to Jean Tougma, who replied
 
Merci pour la réponse, j’ai un code (do if…) mais assez long et je me suis demandé s’il y avait une commande qui le fait de façon simple et rapide. Je pense q j vais m contenter de continuer avec le do if. Bonne soirée !
 
Thankyou for the reply.  I have a code (do if...) but quite long and I wondered if there was a command which does it in a quick and simple way.  I think I am going to settle for continuing with the do if.  Have a nice evening!

Anyway, I suspect it's now sorted
 
John
Reply | Threaded
Open this post in threaded view
|

Re: Geometric codification in SPSS 16

Spousta Jan
In reply to this post by Jean Gabriel TOUGMA
Hello Jean Gabriel,

Suppose your coded variable is named "geometric". Then you can obtain your dummies by running this syntax:


vector dummy(5).
form dummy1 to dummy5 (f2).
compute #rest = geometric.

loop #i = 1 to 5.
- compute dummy(#i) = mod(#rest, 2**#i ) > 0 .
- compute #rest = #rest - dummy(#i) *  2**(#i-1)  .
end loop.
execute.

Best regards,

Jan

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jean Gabriel TOUGMA
Sent: Tuesday, September 15, 2009 3:57 PM
To: [hidden email]
Subject: Geometric codification in SPSS 16

Hello,

I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8, 16.
If there are many products cultivated, we add the codes together and we can have codes from 0 to 31.  In French, it is called geometric codification.

Is there a command, in spss 16,  to decompose this variable to dummy variables according to each codes from 0 to 31?

Thanks for your response.



_____________________________________________________

TOUGMA Jean Gabriel

Ingénieur Statisticien Economiste

Tel : (226) 50 32 42 02 / 70 44 35 81

_____________________________________________________

Ne vous souciez pas d'être meilleur que vos contemporains ou vos prédécesseurs, occupez-vous d'être meilleur que vous-même.



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



_____________
Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem.

Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu.


This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission.

Are you sure that you really need a print version of this message and/or its attachments? Think about nature.

-.- --

=====================
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: Geometric codification in SPSS 16

John F Hall

Much neater than Bruce Weaver's solution or mine, but more advanced syntax.
----- Original Message -----
Sent: Wednesday, September 16, 2009 9:50 AM
Subject: Re: Geometric codification in SPSS 16


Hello Jean Gabriel,

Suppose your coded variable is named "geometric". Then you can obtain your dummies by running this syntax:


vector dummy(5).
form dummy1 to dummy5 (f2).
compute #rest = geometric.

loop #i = 1 to 5.
- compute dummy(#i) = mod(#rest, 2**#i ) > 0 .
- compute #rest = #rest - dummy(#i) *  2**(#i-1)  .
end loop.
execute.

Best regards,

Jan

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jean Gabriel TOUGMA
Sent: Tuesday, September 15, 2009 3:57 PM
To: [hidden email]
Subject: Geometric codification in SPSS 16

Hello,

I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8, 16.
If there are many products cultivated, we add the codes together and we can have codes from 0 to 31.  In French, it is called geometric codification.

Is there a command, in spss 16,  to decompose this variable to dummy variables according to each codes from 0 to 31?

Thanks for your response.



_____________________________________________________

TOUGMA Jean Gabriel

Ingénieur Statisticien Economiste

Tel : (226) 50 32 42 02 / 70 44 35 81

_____________________________________________________

Ne vous souciez pas d'être meilleur que vos contemporains ou vos prédécesseurs, occupez-vous d'être meilleur que vous-même.



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



_____________
Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem.

Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu.


This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission.

Are you sure that you really need a print version of this message and/or its attachments? Think about nature.

-.- --

=====================
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: Geometric codification in SPSS 16

Bruce Weaver
Administrator
John F Hall-2 wrote
Much neater than Bruce Weaver's solution or mine, but more advanced syntax.
Yes, Jan's syntax is definitely tighter, and therefore more easily extensible.  E.g., with a few little tweaks, you can easily get the 8 binary digits for numbers in the range 0-255.  


new file.
input program.
loop x = 0 to 255. /* X = decimal number .
end case.
end loop.
end file.
end input program.
exe.

vector bit(8).
format bit1 to bit8 (f1.0).
compute #rest = x.

loop #i = 1 to 8.
- compute bit(#i) = mod(#rest, 2**#i ) > 0 .
- compute #rest = #rest - bit(#i) *  2**(#i-1)  .
end loop.
execute.

* Reverse order of bits to list them in the usual fashion .

match files file = * / keep = x bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 .
list .
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Geometric codification in SPSS 16

Peck, Jon
Although there have been good pure-SPSS solutions posted, I'd like to show you how easy this problem of picking out the powers of two present in a variable value is using the brand new SPSSINC TRANS extension command.  That command allows you to pass the active data through a Python function without having to write all the wrapper code.  You just specify the function call.  Here's a solution with explanation following.

begin program.
def bitwise(x):
  return [(x & 2**i) > 0 for i in range(5)]
end program.

spssinc trans result = x1 x2 x3 x4 x5 asinteger=x
/formula  bitwise(x=input).

The begin/end program block defines a Python function named bitwise that takes a variable as its parameter and returns a set of 0/1 values for each power of 2 found in the value.  (It checks 2**0 through 2**4 as written.)  The program is in-line, but it could have been a function in an arbitrary module.

The SPSSINC TRANS extension command calls this just-defined function asking for 5 numeric result variables to be created.

The parameter value is specified to be converted to an integer before calling the function, since SPSS variables are always double precision floating point and the function is using bitwise operations appropriate for an integer representation.  (This could, of course, have been done in the Python code.)

The formula subcommand says to call the bitwise function with its parameter, x, set to the value of a variable named input.

That's all it takes.

This solution requires at least V17 with the Python plugin and, of course, the extension command, which can be downloaded from Developer Central, www.spss.com/devcentral.

Regards,
Jon Peck

=====================
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: Geometric codification in SPSS 16

Jean Gabriel TOUGMA
In reply to this post by Spousta Jan
Hello,
Thanks all for your helps. I think it will be easier for me to adapt this
code below to my job.
Best regards,



-----Message d'origine-----
De : SPSSX(r) Discussion [mailto:[hidden email]] De la part de
Spousta Jan
Envoyé : mercredi 16 septembre 2009 07:50
À : [hidden email]
Objet : Re: Geometric codification in SPSS 16

Hello Jean Gabriel,

Suppose your coded variable is named "geometric". Then you can obtain your
dummies by running this syntax:


vector dummy(5).
form dummy1 to dummy5 (f2).
compute #rest = geometric.

loop #i = 1 to 5.
- compute dummy(#i) = mod(#rest, 2**#i ) > 0 .
- compute #rest = #rest - dummy(#i) *  2**(#i-1)  .
end loop.
execute.

Best regards,

Jan

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Jean Gabriel TOUGMA
Sent: Tuesday, September 15, 2009 3:57 PM
To: [hidden email]
Subject: Geometric codification in SPSS 16

Hello,

I have a variable in agriculture which is coded like this 0, 1, 2, 4, 8, 16.
If there are many products cultivated, we add the codes together and we can
have codes from 0 to 31.  In French, it is called geometric codification.

Is there a command, in spss 16,  to decompose this variable to dummy
variables according to each codes from 0 to 31?

Thanks for your response.



_____________________________________________________

TOUGMA Jean Gabriel

Ingénieur Statisticien Economiste

Tel : (226) 50 32 42 02 / 70 44 35 81

_____________________________________________________

Ne vous souciez pas d'être meilleur que vos contemporains ou vos
prédécesseurs, occupez-vous d'être meilleur que vous-même.

====================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: Geometric codification in SPSS 16

Richard Ristow
In reply to this post by Peck, Jon
At 12:12 PM 9/16/2009, Peck, Jon wrote:

>Although there have been good pure-SPSS solutions posted, I'd like
>to show you how easy this problem of picking out the powers of two
>present in a variable value is using the brand new SPSSINC TRANS
>extension command.  That command allows you to pass the active data
>through a Python function without having to write all the wrapper code.

I've wondered: Does this force a data pass? That is, if you want to
run some other transformation commands or run a procedure right
after, does this mean an extra pass? That can make a difference in
the speed of processing very large files.

=====================
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: Geometric codification in SPSS 16 and the SPSS TRANS module

Peck, Jon
See below.

-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Wednesday, September 16, 2009 1:20 PM
To: Peck, Jon; [hidden email]
Subject: Re: Geometric codification in SPSS 16

At 12:12 PM 9/16/2009, Peck, Jon wrote:

>Although there have been good pure-SPSS solutions posted, I'd like
>to show you how easy this problem of picking out the powers of two
>present in a variable value is using the brand new SPSSINC TRANS
>extension command.  That command allows you to pass the active data
>through a Python function without having to write all the wrapper code.

I've wondered: Does this force a data pass? That is, if you want to
run some other transformation commands or run a procedure right
after, does this mean an extra pass? That can make a difference in
the speed of processing very large files.
[peck]
Yes (as documented in the dialog help), this command requires a data pass.  And passing the data through the Python process is necessarily slower than mainlining it through the standard spssengine process, which is pretty good at pumping data.

It would be ideal if Python functions could just be dropped into the transformation system and used like built-in ones.  As I wrote on my blog recently (insideout.spss.com), that's a big architectural challenge that I hope we overcome at some point.

In the meantime, this command gives you convenient access to a huge amount of existing functionality as well as an easy way to process data with functions you write yourself.  And, unlike the transformation system functions, it can create many variables with one function call

Regards,
Jon

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