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
STATA can't handle TOEPLITZ 1 (MDEPENDENT(1)) and AR(1) when bootstrapping mixed modelsTOEPLITZ 1 (MDEPENDENT(1)) bootstrap, reps(20) seed(1) saving(mdep1test): mixed Pain i.RANDOM W W2 …
nwcommands "invalid" errorHello, I just discovered the nwcommands in stata for network analysis. This will make life so much e…
Looping through two different sets of valuesI have data from several years. Each is stored in a file entitled "year 1" "year 2" .... "year 8". T…
Filling in Missing YearsHi Statalist, I'm trying to fill in missing years for my dataset, but something is off. The origina…
How to make a loop continue working if a variable it is not found?Hello. I am trying to generate graphs from some variables. I do not have all possible combinations …
Subscribe to:
Post Comments (Atom)
0 Response to Categorizing values within a single variable via loop
Post a Comment