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
Mediation problemHi all,I was investigating whether political identity would affect income through social networks, s…
Generate a new variable and assigns 1 after a value increases in other variable.Dear Statalist users, I've been still struggling for a few hours after I tried several commands sea…
What is the prediction model to predict the probability?In a paper, Dasgupta, 2019 used Difference-in-Difference approach to see whether anticollusion laws …
Calculate number of days from selected date to the end of quarterDear All, If I have a table as below: ClinicID Visited Date 001 23Feb2021 002 15Apr2021 00…
Temporary names and Mata matrix operationsDoes anyone know why the space after the row-join operator and before the tempname matrix matters in…
Subscribe to:
Post Comments (Atom)
0 Response to Categorizing values within a single variable via loop
Post a Comment