Announcement

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

  • Transform a variable to a set mean and standard deviation- Stata 13

    Hi, I am trying to transform a variable so that it has a set mean and standard deviation. I believe this is the syntax I need to use:
    std(exp) [, mean(#) std(#)]
    However, the std command no longer works in Stata 13. Does anyone know how to do this in the new version of Stata?

  • #2
    Show exactly what you typed and how Stata responded. Is this what you want?

    Code:
    . webuse nhanes2f,clear
    
    . egen xweight = std(weight), mean(3) std(4)
    
    . sum weight xweight
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
          weight |     10,337    71.90088    15.35515      30.84     175.88
         xweight |     10,337           3           4  -7.696318   30.08646
    
    . corr xweight weight
    (obs=10,337)
    
                 |  xweight   weight
    -------------+------------------
         xweight |   1.0000
          weight |   1.0000   1.0000
    
    
    .
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    Stata Version: 17.0 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Note too that std isn't a standalone command. It is a function used with egen.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      Stata Version: 17.0 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        This is incredibly helpful! Thank you so much!

        Comment

        Working...
        X