SPSS Statistics

 View Only
  • 1.  python question

    Posted Wed February 14, 2024 11:24 AM

    Morning, is there a way to compute a variable within a python block? 

    something equal to this [compute flag=1]

    i was thinking spss.Submit[compute flag=1] but am getting an error.  Thanks Art



    ------------------------------
    Art Jack
    ------------------------------


  • 2.  RE: python question

    Posted Wed February 14, 2024 03:37 PM

    A Python function is called with (rounded) parantheses, the SPSS command to execute is a delimited string for Python, and SPSS commands are generally terminated by a full stop. Try

    spss.Submit('compute flag=1 .')

    If you need the effect immediatly, you may append

    spss.Submit('execute .')



    ------------------------------
    Kai Borgolte
    ------------------------------



  • 3.  RE: python question

    IBM Champion
    Posted Wed February 14, 2024 03:50 PM

    It's true that the command(s) need to be quoted, but the Submit function will automatically append a period if one is not present.  The argument can be a Python list or a simple string.



    ------------------------------
    Jon Peck
    ------------------------------