Good evening,
I am new to Stata and have been researching and consulting the help command on a problem with no luck.
I am trying to create a new variable "hour_groups" that categorizes the "hour" variable into 4 groups, e.g. 0 to 6 (a.m.) is assigned the number 1, 7 to 12 is assigned 2 and so on. I'm trying the foreach and and forvalues command. Any help is appreciated. Is it possible to generate a new variable while categorizing in the same command?
Related Posts with Categorizing values within a single variable via loop
Predictors of improvement over timeDear statalist members, I would like to model predictors of improvement in a binary variable over t…
Merge not matching for one year for a specific variable unrelated to the mergeI am looking at data on recycling and compost rates and have merged this data with recycling and was…
Aggregating individual-level data to studysite-level dataDear all, I am still very new to Stata and would need your help with the following: I am currently …
Reshape Long to Wide to create dummy variablesI currently have data that looks like this: a X 0 a Y 0 a Y 1 b X 0 b Y 0 b Z 1 c X 1 c Y 1 c Z 0 …
Difference-in-difference model with continuous treatment levelsHi all, For my master thesis I have to calculate the effect of CSR investment on various performanc…
Subscribe to:
Post Comments (Atom)
0 Response to Categorizing values within a single variable via loop
Post a Comment