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!
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!
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
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?
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.
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?"
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.)?
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
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?
I don't have you as a professor anymore and you're still helping me learn-- thank you!!
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!
thank you so much Alan, I wish you the best...to Rome with love
thank you very much for uploading this video. This was very helpful
Great tutorial, thanks!
Muchas gracias!! Eres el mejor :)
Thank you!
You are my new hero :)
+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.
Sure Alan. Thanks.
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!
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
Please i need your help for data visualization
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?
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.
Using bysort is there a way to see medians or p values?
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?"
How do i summarize variables and only show mean and standard deviation and not freq or min & max
How about:
sysuse auto, clear
tabstat price mpg headroom, statistics(mean sd)
Alan Neustadtl yup that worked. Tabsat variables, statistics (mean sd) columns (statistics) 👍🏼
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.)?
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
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?
Steven5727 Sure...what email address did you use on Stata list?
Alan Neustadtl krap_m@hotmail.com
señor no entiendo
autolike para no desaparecer
x2