Announcement

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

  • unknown function () when trying to code a simple formula using existing variables

    Code:
    //Fem, screat<=0.7
    replace gfrRB = 142*(screat/0.7)**-0.241*(0.9938**age)*1.012 if screat<=0.7
    //Fem, screat>0.7
    replace gfrRB = 142 * (screat/0.7)**-1.200 * (0.9938**age) * 1.012 if screat>0.7
    //Male, screat<=0.9
    replace gfrRB = 142 * (screat/0.9)**-0.302 * (0.9938**age) if screat<=0.9
    //Male, screat>0.9
    replace gfrRB = 142 * (screat/0.9)**-1.200 * (0.9938**age) if screat>0.9
    Where Screat and age are variables

  • #2
    ** is not the power operator in Stata. See

    Code:
    help operators
    You need ^.

    Comment


    • #3
      There is no double asterisk operator in Stata. Perhaps you are trying to use the power operator? If so, in Stata, this is denoted by ^. See
      Code:
      help operator

      Comment


      • #4
        Perhaps your 8 lines of code in post #1 are taken from different places in your actual code.

        If not, please note that nothing in that code distinguishes females from males, so in fact everyone will be initially assigned the value appropriate for a female and which will then be replaced with the value appropriate for a male.

        Comment

        Working...
        X