Announcement

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

  • problems with temporary variables in my Ado-file

    Hi all,
    I am pretty new to Stata mata language.
    I am trying to write a program to estimate risk preference parameters.After defining the program and arguments, i have created
    some temporary variables which i subsequently use to initialize the data as shown in the except below


    program drop ML_eut3
    program define ML_eut3
    * specify the arguments of this program
    args lnf r
    * declare the temporary variables to be used
    tempvar choice pa1 pa2 pb1 pb2 endow la1 la2 lb1 lb2 y0 y1 y2 y3 euL euR euDiff

    quietly {
    * initialize the data
    generate int `choice' = $ML_y1
    generate double `pa1' = $ML_y2
    generate double `pa2' = $ML_y3
    generate double `pb1' = $ML_y4
    generate double `pb2' = $ML_y5

    However when i call the program, stata returns an invalid syntax as shown below

    rgs lnf r
    - tempvar choice pa1 pa2 pb1 pb2 endow la1 la2 lb1 lb2 y0 y1 y2 y3 euL euR euDiff
    - quietly {
    - generate `choice' = $ML_y1
    = generate __00000A =
    invalid syntax
    generate double `pa1' = $ML_y2
    generate double `pa2' = $ML_y3

    I am using the latest version of Stata and i look forward to your assistance

  • #2
    This does not refer to Mata. As earlier advised privately, this should be posted in General.

    Comment

    Working...
    X