Spps command for put comments

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

Spps command for put comments

behnaz shirazi-2
Hello All
I am new in spss and I work with spss 14.I need to put comments in my spss
output .Do you how I can apply this wihin my spss code.I know the title
command but I need more than 64 character.



Thank you
Behnaz

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
Reply | Threaded
Open this post in threaded view
|

Re: Spps command for put comments

Edward Boadi
You may use :

echo " .............Comments........................... ".

Regards.
Edward.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of
behnaz shirazi
Sent: Tuesday, October 24, 2006 4:39 PM
To: [hidden email]
Subject: Spps command for put comments


Hello All
I am new in spss and I work with spss 14.I need to put comments in my spss
output .Do you how I can apply this wihin my spss code.I know the title
command but I need more than 64 character.



Thank you
Behnaz

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
Reply | Threaded
Open this post in threaded view
|

Re: Spps command for put comments

Melissa Ives
In reply to this post by behnaz shirazi-2
We always check the "Display commands in the log" button on the
Edit-->Options-->Viewer tab at the bottom left corner.

Then when you add comments (as below) in the syntax and run them, they
will be included in the output.

*** Here's why I added the following syntax.
Compute.....
Exe.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
behnaz shirazi
Sent: Tuesday, October 24, 2006 3:39 PM
To: [hidden email]
Subject: [SPSSX-L] Spps command for put comments

Hello All
I am new in spss and I work with spss 14.I need to put comments in my
spss output .Do you how I can apply this wihin my spss code.I know the
title command but I need more than 64 character.



Thank you
Behnaz

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.
Reply | Threaded
Open this post in threaded view
|

(no subject)

Jamie Burnett-3
Hi, I would like to calculate in SPSS a new variable that takes all
values for any combination of 8 binary variables. For example I have 9
binary variables in my SPSS file and therefore my new variable will
contain 512 possible categories. Does anyone have a macro or loop
function that would do this for me?


Thanks

Jamie





============================
This e-mail and all attachments it may contain is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Ipsos MORI and its associated companies. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this e-mail is strictly prohibited. Please contact the sender if you have received this e-mail in error.
============================
Reply | Threaded
Open this post in threaded view
|

(no subject)

Stephen Hampshire
I'm sure there's a more cunning solution, but what I normally do in this
situation is recode them so that the variable codes are 100000000, 10000000,
1000000, 100000, 10000, 1000, 100, 10, 1 and then sum them.

Stephen

> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of
> Jamie Burnett
> Sent: 02 November 2006 10:48
> To: [hidden email]
> Subject:
>
>
> Hi, I would like to calculate in SPSS a new variable that takes all
> values for any combination of 8 binary variables. For example I have 9
> binary variables in my SPSS file and therefore my new variable will
> contain 512 possible categories. Does anyone have a macro or loop
> function that would do this for me?
>
>
> Thanks
>
> Jamie
>
>
>
>
>
> ============================
> This e-mail and all attachments it may contain is confidential
> and intended solely for the use of the individual to whom it is
> addressed. Any views or opinions presented are solely those of
> the author and do not necessarily represent those of Ipsos MORI
> and its associated companies. If you are not the intended
> recipient, be advised that you have received this e-mail in error
> and that any use, dissemination, printing, forwarding or copying
> of this e-mail is strictly prohibited. Please contact the sender
> if you have received this e-mail in error.
> ============================
>
Reply | Threaded
Open this post in threaded view
|

Re: [All combinations of several binary variables]

Richard Ristow
In reply to this post by Jamie Burnett-3
At 05:48 AM 11/2/2006, Jamie Burnett wrote:

>I would like to calculate in SPSS a new variable
>that takes all values for any combination of 8
>binary variables. For example I have 9 binary
>variables in my SPSS file and therefore my new
>variable will contain 512 possible categories.

How to generate all combinations of a set of
binary variables has come up from time to time.
(Once you have the binary variables, you can
combine them in one variable, if you like, using
Stephen Hampshire's approach, or some such.)  To
generate the combinations, here are two methods,
from thread "Generating all posibble binary
patterns for m variables", 5-6 July 2006.

Using MATRIX; at 02:22 AM 7/6/2006, Marta García-Granero wrote:

>MATRIX.
>* Change this value if other number of variables is needed *.
>COMPUTE nvars=4.      /* Example for x1 to x4 binary patterns *.
>COMPUTE subset={0;1}. /* Nucleus of the dataset (only for x1) *.
>COMPUTE n=NROW(subset).
>LOOP i=2 TO nvars.    /* Iteratively unfold for x2... to nvars *.
>- COMPUTE subset={MAKE(n,1,0),subset;MAKE(n,1,1),subset}.
>- COMPUTE n=NROW(subset).
>END LOOP.
>PRINT subset
>  /FORMAT='F2.0'
>  /TITLE='All binary patterns for requested number of variables'.
>END MATRIX.
>
>I haven't added the final lines that would
>export the variables to the dataset, but that's easy if you want it.
>
>This code uses only one loop, not several
>nested. It's very fast, even for 10 or more variables. Cute, isn't it?

Using macro and INPUT PROGRAM; at 03:51 PM
7/5/2006, Richard Ristow wrote:

>Anyway, SPSS draft output:
>..........................
>
>DEFINE !AllComb(Nvars=!Default(3) !TOKENS(1))
>.   /**/ ECHO  !QUOTE(!CONCAT('    Count ',!Nvars,' variables')).
>.  NEW FILE.
>.  INPUT PROGRAM.
>.     NUMERIC Case    (COMMA8).
>.     LEAVE   Case.
>.     VECTOR  X( !Nvars ,F2).
>.     !LET !Last_X = !CONCAT('X',!Nvars)
>.     LEAVE   X1 TO !Last_X .
>.     RECODE  X1 TO !Last_X  (ELSE = 0).
>*.
>.     NUMERIC  #LIMIT        (F7)
>               /#DIGIT #INDEX (F4)
>               /#CARRY        (F2).
>.     COMPUTE    #LIMIT = 2** !Nvars .
>.     /*--   PRINT / '    Write ' #LIMIT(F7) ' cases'.
>
>*     Write the first case - all zeroes    .
>.     COMPUTE    Case   = 1.
>.     END CASE.
>
>*     Write all other cases                .
>.     LOOP       Case   = 2 TO #LIMIT.
>.     /*--   PRINT / '    Case  ' Case(F7).
>.        COMPUTE #CARRY = 1.
>.        LOOP    #DIGIT = 1 TO !Nvars .
>.           COMPUTE #INDEX = !Nvars - #DIGIT + 1.
>.     /*--   PRINT / '    Digit ' #DIGIT(F7) ' index ' #INDEX (F7).
>.           DO IF X(#INDEX) = 1.
>.              COMPUTE X(#INDEX) = 0.
>.              COMPUTE #CARRY    = 1.
>.           ELSE.
>.              COMPUTE X(#INDEX) = 1.
>.              COMPUTE #CARRY    = 0.
>.           END IF.
>.        END LOOP IF #CARRY EQ 0.
>.     /*--   PRINT / '    Case  ' Case(F7) ': '
>       /*--           X1 TO !Last_X          .
>       END CASE.
>.     END LOOP.
>.  END FILE.
>.  END INPUT PROGRAM.
>!ENDDEFINE.
>
>*.
>*.
>PRESERVE.
>SET MPRINT ON.
>*.
>1462 M>  *.
>!AllComb
>.
>1463 M>
>1464 M>  .
>1465 M>  . ECHO '    Count 3 variables'.
>     Count 3 variables
>1466 M>  NEW FILE.
>1467 M>  INPUT PROGRAM.
>1468 M>  NUMERIC Case (COMMA8).
>1469 M>  LEAVE Case.
>1470 M>  VECTOR X( 3 ,F2).
>1471 M>  . LEAVE X1 TO X3.
>1472 M>  RECODE X1 TO X3 (ELSE = 0).
>1473 M>  NUMERIC #LIMIT (F7) /#DIGIT #INDEX (F4) /#CARRY (F2).
>1474 M>  COMPUTE #LIMIT = 2** 3.
>1475 M>  COMPUTE Case = 1.
>1476 M>  END CASE.
>1477 M>  LOOP Case = 2 TO #LIMIT.
>1478 M>  COMPUTE #CARRY = 1.
>1479 M>  LOOP #DIGIT = 1 TO 3.
>1480 M>  COMPUTE #INDEX = 3 - #DIGIT + 1.
>1481 M>  DO IF X(#INDEX) = 1.
>1482 M>  COMPUTE X(#INDEX) = 0.
>1483 M>  COMPUTE #CARRY = 1.
>1484 M>  ELSE.
>1485 M>  COMPUTE X(#INDEX) = 1.
>1486 M>  COMPUTE #CARRY = 0.
>1487 M>  END IF.
>1488 M>  END LOOP IF #CARRY EQ 0.
>1489 M>  END CASE.
>1490 M>  END LOOP.
>1491 M>  END FILE.
>1492 M>  END INPUT PROGRAM
>1493 M>  .
>*.
>1494 M>  *.
>RESTORE.
>1495 M>  RESTORE.
>LIST.
>
>List
>|-------------------------|------------------------|
>|Output Created           |05-JUL-2006 16:48:13    |
>|-------------------------|------------------------|
>     Case X1 X2 X3
>
>        1  0  0  0
>        2  0  0  1
>        3  0  1  0
>        4  0  1  1
>        5  1  0  0
>        6  1  0  1
>        7  1  1  0
>        8  1  1  1
>
>Number of cases read:  8    Number of cases listed:  8
>
>
>*.
>*.
>PRESERVE.
>SET MPRINT ON.
>*.
>1501 M>  *.
>!AllComb NVars=4
>.
>1502 M>
>1503 M>  .
>1504 M>  . ECHO '    Count 4 variables'.
>     Count 4 variables
>1505 M>  NEW FILE.
>1506 M>  INPUT PROGRAM.
>1507 M>  NUMERIC Case (COMMA8).
>1508 M>  LEAVE Case.
>1509 M>  VECTOR X( 4 ,F2).
>1510 M>  . LEAVE X1 TO X4.
>1511 M>  RECODE X1 TO X4 (ELSE = 0).
>1512 M>  NUMERIC #LIMIT (F7) /#DIGIT #INDEX (F4) /#CARRY (F2).
>1513 M>  COMPUTE #LIMIT = 2** 4.
>1514 M>  COMPUTE Case = 1.
>1515 M>  END CASE.
>1516 M>  LOOP Case = 2 TO #LIMIT.
>1517 M>  COMPUTE #CARRY = 1.
>1518 M>  LOOP #DIGIT = 1 TO 4.
>1519 M>  COMPUTE #INDEX = 4 - #DIGIT + 1.
>1520 M>  DO IF X(#INDEX) = 1.
>1521 M>  COMPUTE X(#INDEX) = 0.
>1522 M>  COMPUTE #CARRY = 1.
>1523 M>  ELSE.
>1524 M>  COMPUTE X(#INDEX) = 1.
>1525 M>  COMPUTE #CARRY = 0.
>1526 M>  END IF.
>1527 M>  END LOOP IF #CARRY EQ 0.
>1528 M>  END CASE.
>1529 M>  END LOOP.
>1530 M>  END FILE.
>1531 M>  END INPUT PROGRAM
>1532 M>  .
>1533 M>
>*.
>1534 M>  *.
>RESTORE.
>1535 M>  RESTORE.
>LIST.
>
>List
>|-------------------------|------------------------|
>|Output Created           |05-JUL-2006 16:48:14    |
>|-------------------------|------------------------|
>     Case X1 X2 X3 X4
>
>        1  0  0  0  0
>        2  0  0  0  1
>        3  0  0  1  0
>        4  0  0  1  1
>        5  0  1  0  0
>        6  0  1  0  1
>        7  0  1  1  0
>        8  0  1  1  1
>        9  1  0  0  0
>       10  1  0  0  1
>       11  1  0  1  0
>       12  1  0  1  1
>       13  1  1  0  0
>       14  1  1  0  1
>       15  1  1  1  0
>       16  1  1  1  1
>
>Number of cases read:  16    Number of cases listed:  16
Reply | Threaded
Open this post in threaded view
|

Re: [All combinations of several binary variables]

Hector Maletta
I think the proposed approach is an overkill if you are dealing with an
actual data aet. Just a sum of the binaries, each multiplied by a power of
ten, would do the same job. Assume the 9 variables are called A, B, C, D, E,
F, G, H and I. Then the new variable with 512 possible values is computed
by:

COMPUTE COMBINEDVAR=1000000000
+100000000*A+10000000*B+1000000*C+100000*D+10000*D+1000*E+100*F+10*H+I.

The 100000000o at the beginning ensures that a case with an all-zero
combination comes out with a 100000000 value, which is somewhat handier than
zero in some situations and to visualize the resulting patterns in an easier
way. One can do without it if desired as it is a matter of taste.

The resulting number for a case, ignoring the first 1, will tell which of
the eight questions is answered with a 1 and which with a zero, like in
110101111 (first, third and the last four were answered positively, second
and four negatively).

In an actual data set, of course, some of the 512 combinations may not be
present. If you want a fictitious data set with all the combinations, you
may follow Marta's procedure.

Hector

-----Mensaje original-----
De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de
Richard Ristow
Enviado el: 04 November 2006 23:53
Para: [hidden email]
Asunto: Re: [All combinations of several binary variables]

At 05:48 AM 11/2/2006, Jamie Burnett wrote:

>I would like to calculate in SPSS a new variable
>that takes all values for any combination of 8
>binary variables. For example I have 9 binary
>variables in my SPSS file and therefore my new
>variable will contain 512 possible categories.
=
How to generate all combinations of a set of
binary variables has come up from time to time.
(Once you have the binary variables, you can
combine them in one variable, if you like, using
Stephen Hampshire's approach, or some such.)  To
generate the combinations, here are two methods,
from thread "Generating all posibble binary
patterns for m variables", 5-6 July 2006.

Using MATRIX; at 02:22 AM 7/6/2006, Marta García-Granero wrote:

>MATRIX.
>* Change this value if other number of variables is needed *.
>COMPUTE nvars=4.      /* Example for x1 to x4 binary patterns *.
>COMPUTE subset={0;1}. /* Nucleus of the dataset (only for x1) *.
>COMPUTE n=NROW(subset).
>LOOP i=2 TO nvars.    /* Iteratively unfold for x2... to nvars *.
>- COMPUTE subset={MAKE(n,1,0),subset;MAKE(n,1,1),subset}.
>- COMPUTE n=NROW(subset).
>END LOOP.
>PRINT subset
>  /FORMAT='F2.0'
>  /TITLE='All binary patterns for requested number of variables'.
>END MATRIX.
>
>I haven't added the final lines that would
>export the variables to the dataset, but that's easy if you want it.
>
>This code uses only one loop, not several
>nested. It's very fast, even for 10 or more variables. Cute, isn't it?

Using macro and INPUT PROGRAM; at 03:51 PM
7/5/2006, Richard Ristow wrote:

>Anyway, SPSS draft output:
>..........................
>
>DEFINE !AllComb(Nvars=!Default(3) !TOKENS(1))
>.   /**/ ECHO  !QUOTE(!CONCAT('    Count ',!Nvars,' variables')).
>.  NEW FILE.
>.  INPUT PROGRAM.
>.     NUMERIC Case    (COMMA8).
>.     LEAVE   Case.
>.     VECTOR  X( !Nvars ,F2).
>.     !LET !Last_X = !CONCAT('X',!Nvars)
>.     LEAVE   X1 TO !Last_X .
>.     RECODE  X1 TO !Last_X  (ELSE = 0).
>*.
>.     NUMERIC  #LIMIT        (F7)
>               /#DIGIT #INDEX (F4)
>               /#CARRY        (F2).
>.     COMPUTE    #LIMIT = 2** !Nvars .
>.     /*--   PRINT / '    Write ' #LIMIT(F7) ' cases'.
>
>*     Write the first case - all zeroes    .
>.     COMPUTE    Case   = 1.
>.     END CASE.
>
>*     Write all other cases                .
>.     LOOP       Case   = 2 TO #LIMIT.
>.     /*--   PRINT / '    Case  ' Case(F7).
>.        COMPUTE #CARRY = 1.
>.        LOOP    #DIGIT = 1 TO !Nvars .
>.           COMPUTE #INDEX = !Nvars - #DIGIT + 1.
>.     /*--   PRINT / '    Digit ' #DIGIT(F7) ' index ' #INDEX (F7).
>.           DO IF X(#INDEX) = 1.
>.              COMPUTE X(#INDEX) = 0.
>.              COMPUTE #CARRY    = 1.
>.           ELSE.
>.              COMPUTE X(#INDEX) = 1.
>.              COMPUTE #CARRY    = 0.
>.           END IF.
>.        END LOOP IF #CARRY EQ 0.
>.     /*--   PRINT / '    Case  ' Case(F7) ': '
>       /*--           X1 TO !Last_X          .
>       END CASE.
>.     END LOOP.
>.  END FILE.
>.  END INPUT PROGRAM.
>!ENDDEFINE.
>
>*.
>*.
>PRESERVE.
>SET MPRINT ON.
>*.
>1462 M>  *.
>!AllComb
>.
>1463 M>
>1464 M>  .
>1465 M>  . ECHO '    Count 3 variables'.
>     Count 3 variables
>1466 M>  NEW FILE.
>1467 M>  INPUT PROGRAM.
>1468 M>  NUMERIC Case (COMMA8).
>1469 M>  LEAVE Case.
>1470 M>  VECTOR X( 3 ,F2).
>1471 M>  . LEAVE X1 TO X3.
>1472 M>  RECODE X1 TO X3 (ELSE = 0).
>1473 M>  NUMERIC #LIMIT (F7) /#DIGIT #INDEX (F4) /#CARRY (F2).
>1474 M>  COMPUTE #LIMIT = 2** 3.
>1475 M>  COMPUTE Case = 1.
>1476 M>  END CASE.
>1477 M>  LOOP Case = 2 TO #LIMIT.
>1478 M>  COMPUTE #CARRY = 1.
>1479 M>  LOOP #DIGIT = 1 TO 3.
>1480 M>  COMPUTE #INDEX = 3 - #DIGIT + 1.
>1481 M>  DO IF X(#INDEX) = 1.
>1482 M>  COMPUTE X(#INDEX) = 0.
>1483 M>  COMPUTE #CARRY = 1.
>1484 M>  ELSE.
>1485 M>  COMPUTE X(#INDEX) = 1.
>1486 M>  COMPUTE #CARRY = 0.
>1487 M>  END IF.
>1488 M>  END LOOP IF #CARRY EQ 0.
>1489 M>  END CASE.
>1490 M>  END LOOP.
>1491 M>  END FILE.
>1492 M>  END INPUT PROGRAM
>1493 M>  .
>*.
>1494 M>  *.
>RESTORE.
>1495 M>  RESTORE.
>LIST.
>
>List
>|-------------------------|------------------------|
>|Output Created           |05-JUL-2006 16:48:13    |
>|-------------------------|------------------------|
>     Case X1 X2 X3
>
>        1  0  0  0
>        2  0  0  1
>        3  0  1  0
>        4  0  1  1
>        5  1  0  0
>        6  1  0  1
>        7  1  1  0
>        8  1  1  1
>
>Number of cases read:  8    Number of cases listed:  8
>
>
>*.
>*.
>PRESERVE.
>SET MPRINT ON.
>*.
>1501 M>  *.
>!AllComb NVars=4
>.
>1502 M>
>1503 M>  .
>1504 M>  . ECHO '    Count 4 variables'.
>     Count 4 variables
>1505 M>  NEW FILE.
>1506 M>  INPUT PROGRAM.
>1507 M>  NUMERIC Case (COMMA8).
>1508 M>  LEAVE Case.
>1509 M>  VECTOR X( 4 ,F2).
>1510 M>  . LEAVE X1 TO X4.
>1511 M>  RECODE X1 TO X4 (ELSE = 0).
>1512 M>  NUMERIC #LIMIT (F7) /#DIGIT #INDEX (F4) /#CARRY (F2).
>1513 M>  COMPUTE #LIMIT = 2** 4.
>1514 M>  COMPUTE Case = 1.
>1515 M>  END CASE.
>1516 M>  LOOP Case = 2 TO #LIMIT.
>1517 M>  COMPUTE #CARRY = 1.
>1518 M>  LOOP #DIGIT = 1 TO 4.
>1519 M>  COMPUTE #INDEX = 4 - #DIGIT + 1.
>1520 M>  DO IF X(#INDEX) = 1.
>1521 M>  COMPUTE X(#INDEX) = 0.
>1522 M>  COMPUTE #CARRY = 1.
>1523 M>  ELSE.
>1524 M>  COMPUTE X(#INDEX) = 1.
>1525 M>  COMPUTE #CARRY = 0.
>1526 M>  END IF.
>1527 M>  END LOOP IF #CARRY EQ 0.
>1528 M>  END CASE.
>1529 M>  END LOOP.
>1530 M>  END FILE.
>1531 M>  END INPUT PROGRAM
>1532 M>  .
>1533 M>
>*.
>1534 M>  *.
>RESTORE.
>1535 M>  RESTORE.
>LIST.
>
>List
>|-------------------------|------------------------|
>|Output Created           |05-JUL-2006 16:48:14    |
>|-------------------------|------------------------|
>     Case X1 X2 X3 X4
>
>        1  0  0  0  0
>        2  0  0  0  1
>        3  0  0  1  0
>        4  0  0  1  1
>        5  0  1  0  0
>        6  0  1  0  1
>        7  0  1  1  0
>        8  0  1  1  1
>        9  1  0  0  0
>       10  1  0  0  1
>       11  1  0  1  0
>       12  1  0  1  1
>       13  1  1  0  0
>       14  1  1  0  1
>       15  1  1  1  0
>       16  1  1  1  1
>
>Number of cases read:  16    Number of cases listed:  16