Grouping variables in stata. Jan 17, 2018 · I am trying to generate an enumeration variable for groups which are defined by other variables. In the example below I likewise try to generate X which is distinct for every B sorted by A. My question is: why, and how do I create unique groups in a robust way? Can you please post a reproducible example? For example, the complete offending code with a minimal data input that recreates the problem. See help input for creating short example data within a do-file. STATA Tutorials: Creating a Grouped Variable is part of the Methodology Institute Software tutorials sponsored by a grant from the LSE Annual Fund. I need to create 3 group variables of Low, Medium and High temperature. It seems as though egen, group() isn't generating unique groups. Apr 26, 2016 · Temperature varies from 0 to 30. Nov 16, 2022 · I already have an id variable, and I have multiple observations per id, but I want a new id variable containing 1 for the first id, 2 for the second, and so on. (Low temperature carries value of 1 if Temperature is between 0-10), (Medium carries value of 2 if Temperature is between 11-20) and (High carries value of 3 if Temperature is between 21-30). For example, you might want to convert a continuous reading score that ranges from 0 to 100 into 3 groups (say low, medium and high). egen stands for extensions to generate and is used mainly for more advanced operations than can be handled with the gen command. There may be times that you would like to convert a continuous variable into groups. . more Apr 28, 2019 · Sometimes you need to split a variable into groups. There are several ways to achieve this in Stata, in this post we'll use the egen command. ile wvjfha raubsip kbamu honqw grvn wfuikv fhuta pela gurz