Announcement

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

  • Standard Deviation Code

    Hi
    I plan t analyzed the data from ELISA using Stata.
    The data contain OD_1 and OD_2. OD_1 and OD_1 is basically the result of measurement 1 and measurement 2 of 1 sample.
    If i want to generate new variable which contain the standard deviation of those measurement 1 and measurement 2,
    what is the code?

    Thank you


  • #2
    Mifa:
    welcome to this forum.
    Do you mean something along the following lines?
    Code:
    . use "https://www.stata-press.com/data/r17/nlswork.dta"
    (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
    
    . egen wanted=sd( ln_wage) if year<=71 & idcode==1
    
    
    . list idcode ln_wage year wanted if year<=71 & idcode==1
    
           +-------------------------------------+
           | idcode    ln_wage   year     wanted |
           |-------------------------------------|
        1. |      1   1.451214     70   .2988192 |
        2. |      1    1.02862     71   .2988192 |
           +-------------------------------------+
    
    .
    Last edited by Carlo Lazzaro; 06 Feb 2023, 01:00.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo
      Thank you for your response
      Yes, but the command like "sd/std/stdv" is not working in my stata (I use v17).
      I'm not sure why. Therefore it will be help full if you can advice any other alternatives way to get it.

      Kind regards
      Mifa

      Comment


      • #4
        Are you sure you're using egen and not gen? It is a common mistake.

        Comment


        • #5
          Hi Daniel
          I tried both actually and still not work

          Comment


          • #6
            you need to show us, within CODE blocks, exactly what you entered and exactly what Stata gave back; also, it would really help if you were more specific about what doesn't work - please read the FAQ

            Comment

            Working...
            X