Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display and response in python

    Hi. I run the following python script in Stata.
    python:
    from sfi import SFIToolkit
    SFIToolkit.display ('What is your name?')
    name = input () # read a single line and store it in the variable "name"
    print ('Hi' + name + '!')
    end


    Stata doesn't give me the option to type the name in the command windows. What do I have to modify to be able to write the name in Command windows?
    Thanks

  • #2
    Code:
    python:
    
    from sfi import SFIToolkit, Macro
    
    SFIToolkit.stata('display "What is your name?" _request(name)')
    name = Macro.getGlobal('name')
    print(name)
    
    end

    Comment

    Working...
    X