Thanks for your sharing, I can say it is very wonderful.
@SB-ez7wp5 жыл бұрын
Great video. I don't mean to "correct" you, but just to clarify for other viewers a tiny bit, at 5:20, the count option generates the number of individual observations with *non missing* values for the given variable, not just the number of individuals. For example, suppose that of the men from IL, 100 of them have a missing value for their wage. If that were the case, the collapse command would have placed a value of 1588 in the count variable for observation 1 rather than 1688.
@sebastianwaiecon5 жыл бұрын
You're right. Thanks for the clarification. Missing data can be a bit tricky in Stata because it just sort of quietly deals with it in the background without telling you, and it can definitely trip people up.
@xovicente5 жыл бұрын
Thank you. I was so worried about my homework and this helped me a lot.
@KDubberley4 жыл бұрын
Wonderful explanation!
@Luke-cu5xe9 ай бұрын
you saved my life with this vid
@edwincoleman64363 жыл бұрын
Thanks so much. This really helped
@Chillypuwn5 жыл бұрын
Very helpful. Is there any way to generate a new variable, so it does not erase the old data?
@sebastianwaiecon5 жыл бұрын
You might want to look into the egen command.
@sanchezmayurinmarvinbecker48304 жыл бұрын
Hello, I would like to ask a question. How can i generate a new basadate to have the percent of men by educcategory using collapse?
@sebastianwaiecon4 жыл бұрын
Percent is one of the operations you can do with collapse. See the manual for details: www.stata.com/manuals13/dcollapse.pdf
@takesuretozooneyi48365 жыл бұрын
Really useful. How do you avoid losing labels when using the collapse command?
@sebastianwaiecon5 жыл бұрын
I'm not aware of a quick way, but I did find an article discussing this: www.stata.com/support/faqs/data-management/keeping-same-variable-with-collapse/
@takesuretozooneyi48365 жыл бұрын
@@sebastianwaiecon thanx a lot
@dinobrown59563 жыл бұрын
Great Video. How do you restore your previous data? I tried using "restore" after "preserve" but got this: "nothing to restore". Kindly help
@sebastianwaiecon3 жыл бұрын
If I want to go back, I just reload the original dataset. Just make sure to not save over the original data.
@evergreenbella3 жыл бұрын
Thank you for sharing. One question, how can we keep other variables after collapsing??
@sebastianwaiecon3 жыл бұрын
You can keep as many variables as you want - just keep listing them in the command like I did in the video.
@evergreenbella3 жыл бұрын
@@sebastianwaiecon Thank you for your answer! But after collapsing, only affected variables exist. I want other variables and collapsed variables all together.
@sebastianwaiecon3 жыл бұрын
When you collapse, you only get the collapsed variables and the variables you used to divide up the data. It's impossible to get non-collapsed variables to come along because they are tied to the observations in the original dataset, which no longer exists.
@evergreenbella3 жыл бұрын
@@sebastianwaiecon Exactly! Then, there is only one way, which is merging the two datasets (collapsed var dataset and previous dataset) to have all the variables. Is that correct?
@jackgandhi3 жыл бұрын
@@evergreenbella I'm not sure why you'd want to do that. Is the reason you couldn't collapse them that they are string variables? If any of the collapsed categories has any variation in the strings, merging still won't work. If not, you can just include them in the "by" statement.
@WisdomThroughGod3 жыл бұрын
Does anyone know how to run a regression with regards to a specific part of a variable? ex my variable is sex but I want a regression of wages on females and not on men.
@sebastianwaiecon3 жыл бұрын
See my video on categorical data.
@RavindraMulye2 жыл бұрын
Is there a way to resolve stata r(950) error...
@kigakiku20115 жыл бұрын
weird. you're collapsing by a string, but my Stata returns a type mismatch error when I try to do the same
@kigakiku20115 жыл бұрын
nevermind, it's because I was trying to get it to count a string variable. I still can't believe the built-in functions of Stata can't handle basic counting of strings. ridiculous. might as well be using Excel.
@sebastianwaiecon5 жыл бұрын
You might want to check out my video on categorical data for better handling of strings (kzbin.info/www/bejne/h3-apmCQd62kn8U).