Keywords:


powered by
FreeFind

 

Site Map
Feedback



Other
languages

Deutsch
EspaŮol
Francais
Italiano
PortuguÍs
Russian

Do you love this site?

DEFINE !doit(nbval=!TOKENS(1))
 615 M>  DEFINE
 616 M>    !doit(nbval=!TOKENS(1))
INPUT PROGRAM.
 617 M>   INPUT PROGRAM.

>Warning # 6804 in column 3.  Text: !DOIT
>The macro name specified on the DEFINE command duplicates the name of a
>previously defined macro.  This instance will take precedence.

LOOP cnt=1 TO !nbval.
 618 M>  LOOP cnt=1 TO !nbval.
COMPUTE myval=LN(cnt).
 619 M>  COMPUTE myval=LN(cnt).
END CASE.
 620 M>  END CASE.
END LOOP.
 621 M>  END LOOP.
END FILE.
 622 M>  END FILE.
END INPUT PROGRAM.
 623 M>  END INPUT PROGRAM.

 624 M>  
* Next line assumes you need 5 digits.
 625 M>  * Next line assumes you need 5 digits.
FORMAT myval(F8.5).
 626 M>  FORMAT myval(F8.5).
* Define the macro variable.
 627 M>  * Define the macro variable.
DO IF cnt=1.
 628 M>  DO IF cnt=1.
WRITE OUTFILE='c:\temp\macro var.sps' /"DEFINE !values()"/myval.
 629 M>  WRITE OUTFILE='c:\temp\macro var.sps' /"DEFINE !values()"/myval.
ELSE IF cnt<!nbval.
 630 M>  ELSE IF cnt<!nbval.
WRITE OUTFILE='c:\temp\macro var.sps' /myval.
 631 M>  WRITE OUTFILE='c:\temp\macro var.sps' /myval.
ELSE.
 632 M>  ELSE.
WRITE OUTFILE='c:\temp\macro var.sps' /myval /"!ENDDEFINE.".
 633 M>  WRITE OUTFILE='c:\temp\macro var.sps' /myval /"!ENDDEFINE.".
END IF.
 634 M>  END IF.
EXECUTE.
 635 M>  EXECUTE.
* Run the syntax to define the variable.
 636 M>  * Run the syntax to define the variable.
INCLUDE FILE='c:\temp\macro var.sps'.
 637 M>  INCLUDE FILE='c:\temp\macro var.sps'.
EXECUTE.
 638 M>  EXECUTE.
!ENDDEFINE.
 639 M>  !ENDDEFINE.
*///////////////////////////////////.
 640 M>  *///////////////////////////////////.

 641 M>  
!doit nbval=3.
 642 M>  
 643 M>  .
 644 M>  INPUT PROGRAM.
 645 M>  LOOP CNT=1 TO 3.
 646 M>  COMPUTE MYVAL=LN(CNT).
 647 M>  END CASE.
 648 M>  END LOOP.
 649 M>  END FILE.
 650 M>  END INPUT PROGRAM.
 651 M>  FORMAT MYVAL(F8.5).
 652 M>  DO IF CNT=1.
 653 M>  WRITE OUTFILE='c:\temp\macro var.sps' /'DEFINE !values()'/MYVAL.
 654 M>  ELSE IF CNT< 3.
 655 M>  WRITE OUTFILE='c:\temp\macro var.sps' /MYVAL.
 656 M>  ELSE.
 657 M>  WRITE OUTFILE='c:\temp\macro var.sps' /MYVAL /'!ENDDEFINE.'.
 658 M>  END IF.
 659 M>  EXECUTE.
 660 M>  INCLUDE FILE='c:\temp\macro var.sps'.
 660  DEFINE !values()
 660 M>  DEFINE
 661 M>    !values()
 662    .00000
 662 M>    .00000
 663    .69315
 663 M>    .69315
 664   1.09861
 664 M>    1.09861

>Warning # 6804 on line 661 in column 3.  Text: !VALUES
>The macro name specified on the DEFINE command duplicates the name of a
>previously defined macro.  This instance will take precedence.

 665 M>  !ENDDEFINE
 666  !ENDDEFINE.
 666 M>  
 667  
 667 M>  
 668 M>  * End of INCLUDE nesting level 01
 669  * End of INCLUDE nesting level 01.
 669 M>  
 670 M>  EXECUTE
 671 M>   .

 672 M>  
*In the following macro, the macro variable !myvar takes on the values ln(1), ln
   (2) and ln(3).
 673 M>  *In the following macro, the macro variable !myvar takes on the values 
            ln(1), ln(2) and ln(3).

 674 M>  
DEFINE !test()
 675 M>  DEFINE
 676 M>    !test()
!LET !cnt=!NULL
 677 M>   !LET !cnt=!NULL
!LET !val=!EVAL(!values)
 678 M>   !LET !val=!EVAL(!values)
!DO !myvar !IN (!val)
 679 M>   !DO !myvar !IN (!val)
!LET !cnt=!CONCAT(!cnt,!BLANK(1))
 680 M>   !LET !cnt=!CONCAT(!cnt,!BLANK(1))
COMPUTE !CONCAT(var,!LENGTH(!cnt))=!myvar.
 681 M>   COMPUTE !CONCAT(var,!LENGTH(!cnt))=!myvar.

>Warning # 6804 in column 3.  Text: !TEST
>The macro name specified on the DEFINE command duplicates the name of a
>previously defined macro.  This instance will take precedence.

!DOEND
 682 M>  !DOEND
EXECUTE.
 683 M>   EXECUTE.
!ENDDEFINE.
 684 M>  !ENDDEFINE.

 685 M>  
!test.
 686 M>  
 687 M>  .
 688 M>  COMPUTE VAR1 = .00000.
 689 M>  COMPUTE VAR2 = .69315.
 690 M>  COMPUTE VAR3 = 1.09861.
 691 M>  EXECUTE
 692 M>   .
* Next line is to see all five digits.
 693 M>  * Next line is to see all five digits.
FORMAT var1 TO var2 (F8.5).
 694 M>  FORMAT var1 TO var2 (F8.5).
LIST.
 695 M>  LIST.


List

Notes
Output Created 03-JUN-2001 20:39:40
Comments
Input Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 3
Syntax LIST.
Resources Elapsed Time 0:00:00.02





     CNT    MYVAL     VAR1     VAR2     VAR3

    1.00   .00000   .00000   .69315     1.10
    2.00   .69315   .00000   .69315     1.10
    3.00  1.09861   .00000   .69315     1.10


Number of cases read:  3    Number of cases listed:  3

This page was last updated on  2012/03/27        Raynald's SPSS Tools

© Raynald Levesque 2001-12