Announcement

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

  • Generate a new standardized Variable

    Hey, I have a problem.
    My Dataset contains data about executive compensation, a few variables are "GesVG" "ErbrachteMannmonate" among other variables. Now I want to generate a new variable "dGesVG" which divides the variable "GesVG" by "ErbrachteMannmonate" and multiplies this with "12" (months). But I don't know how to generate it. Here is my suggestion:
    gen dGesVG == GesVG/ErbrachteMannmonate*12 when I execute this, stata always tells me "invalid name". I really don't know how to solve this problem.

    Thanks for your help

  • #2
    Try removing one of the equals signs
    Code:
    generate double dGesVG = GesVG / ErbrachteMannmonate * 12
    If that doesn't work, double check that you have spelled the variable names correctly.

    Comment


    • #3
      Thanks for your answer, the variable names are correct and if i command your version, it says "type mismatch" ..
      Last edited by Giulia Wa; 26 Aug 2017, 08:34.

      Comment


      • #4
        It seems as if there is a problem with the division with "/" because if I only incluse multiplying it works.?!

        Comment


        • #5
          This question is also posted at https://stackoverflow.com/questions/...t-new-variable.

          Comment

          Working...
          X