Stata Command Modifiers--if, in, and by/bysort

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 28

  • @adamw2030
    @adamw2030 2 ปีที่แล้ว

    Excellent video. I was trying to do the equivalent of bysorting in R and it ended up being a lot quicker to just load it in Stata and clean it with the bysort function, then move back to R for spatial analysis. Thank you!

  • @laurenb4182
    @laurenb4182 6 ปีที่แล้ว

    I don't have you as a professor anymore and you're still helping me learn-- thank you!!

  • @albertonoe9378
    @albertonoe9378 4 ปีที่แล้ว

    thank you so much Alan, I wish you the best...to Rome with love

  • @zyanyishs
    @zyanyishs 8 ปีที่แล้ว +1

    Hello, I was wondering if you could help me with a problem. I am trying studying groups of different sizes, and I want to count how many cases in a group do I have in a specific category. For example, If i have 5 individuals in the group, how many of them have low levels of sugar. Thanks!

    • @smilex3
      @smilex3  8 ปีที่แล้ว +1

      Carolina, I am uncertain exactly what you are asking. What defines a group? Maybe the following code will help you.
      sysuse auto, clear
      summ mpg, meanonly
      levelsof rep78, local(levels)
      foreach num of numlist `levels' {
      count if rep78==`num' & mpg< r(mean)
      }
      First, I estimate the mean of mpg. Second, I identify the unique values of rep78. Third, I set up a loop. Fourth, within the loop I count the number of cases at each level of rep78 (analogous to your "group") that have values less than the mean of mpg.
      Does this give you a way forward with your problem?
      Best,
      Alan

  • @athenaiximena8967
    @athenaiximena8967 7 ปีที่แล้ว

    Muchas gracias!! Eres el mejor :)

  • @kannank7265
    @kannank7265 11 ปีที่แล้ว

    thank you very much for uploading this video. This was very helpful

  • @leeshingshyan
    @leeshingshyan 8 ปีที่แล้ว

    Hi Alan, Thank you for your video, its very helpful! Just wondering though, would the logical operators, eg & or | functions work if i typed it out in words? Example, instead of saying "something" if A & B, would it work if i used "something" if A and B?

    • @smilex3
      @smilex3  8 ปีที่แล้ว

      I have ti comments. First, you should just try it! The command window is a great place to non-destructively experiment with different commands and options.
      Unfortunately, what you propose will not work. Second, Stata like all programming languages does what it does with great precision and pays no attention my (or your) desires! This is why the online help files are so important.

  • @han.c0401
    @han.c0401 5 ปีที่แล้ว

    Great tutorial, thanks!

  • @intellectamit
    @intellectamit 9 ปีที่แล้ว +1

    You are my new hero :)

    • @smilex3
      @smilex3  9 ปีที่แล้ว

      +Amit Kumar Thank you! I am glad you found it useful. If you have suggestions about new videos about programming in Stata, please let me know.

    • @intellectamit
      @intellectamit 9 ปีที่แล้ว

      Sure Alan. Thanks.

  • @romniyepez5206
    @romniyepez5206 4 ปีที่แล้ว

    Thank you!

  • @myrahahmad
    @myrahahmad 6 ปีที่แล้ว

    Using bysort is there a way to see medians or p values?

    • @smilex3
      @smilex3  6 ปีที่แล้ว

      Can you clarify what you are trying to accomplish? The bysort prefix simply determines how a dataset is sorted to analyze things by groups. For example, "what is the average income by age group?"

  • @danielkrupah
    @danielkrupah 2 ปีที่แล้ว

    Please i need your help for data visualization

  • @descalante7492
    @descalante7492 6 ปีที่แล้ว

    How do i summarize variables and only show mean and standard deviation and not freq or min & max

    • @smilex3
      @smilex3  6 ปีที่แล้ว +1

      How about:
      sysuse auto, clear
      tabstat price mpg headroom, statistics(mean sd)

    • @descalante7492
      @descalante7492 6 ปีที่แล้ว

      Alan Neustadtl yup that worked. Tabsat variables, statistics (mean sd) columns (statistics) 👍🏼

  • @Steven5727
    @Steven5727 11 ปีที่แล้ว

    Hi Allen, I have an issue regarding Stata and hope that you are able to help me with that. How can I get in contact with you outside youtube (by e-mail, facebook etc.)?

    • @smilex3
      @smilex3  11 ปีที่แล้ว +2

      Steven, my work email address is smilex3@umd.edu. Also, the Stata listserv is a tremendous resource with many incredible Stata programmers and researchers who willingly and freely answer just about every question that is posed.
      The URL to get started is www.stata.com/statalist/. If you join, please read the FAQ before posting to understand the list etiquette and how to frame a question that has a good chance of being answered.
      The FAQ is available at www.stata.com/support/faqs/resources/statalist-faq/.
      Best,
      Alan

    • @Steven5727
      @Steven5727 11 ปีที่แล้ว

      Alan Neustadtl I did that, but still no reply on my question. If I do not receive a reply tomorrow, I will send you an e-mail with the same question. If that is okay with you?

    • @smilex3
      @smilex3  11 ปีที่แล้ว

      Steven5727 Sure...what email address did you use on Stata list?

    • @Steven5727
      @Steven5727 11 ปีที่แล้ว

      Alan Neustadtl krap_m@hotmail.com

  • @xavierbeltran8254
    @xavierbeltran8254 4 ปีที่แล้ว +1

    señor no entiendo