hello I need your help
if I want to organize my data and group it by week.
for example, I want to calculate a variable, form this Wednesday to next Tuesday. How do I group it?
specifically, I want to generate a variable in a group of this Wednesday to next Tuesday.
I attach my dataset picture.
I want to get the below code to perform
"collapse (sum) nOI5 nOI10, by(i want to say =>form this Wednesday to next Tuesday)"
However, I don't know how to write a code that a group of this Wednesday to next Tuesday in the variable of the date.
for example
date id
3 1
4 1
5 1
1 1
2 1
I mean is that " egen id = group(i want to say =>form this Wednesday to next Tuesday)
If you know, please tell me
thank you very much
Related Posts with How to group time data
Trying to match patientsHi Statalist, I am trying to create a matched cohort of patients based on a single lab value (CEA).…
Keep duplicate closest to value of observation in previous yearDear Stata Forum, As suggested in the title I have some duplicate values in my data in terms of id …
Labelling units in a numlist of a loopDear all, For a number of countries in PISA, I am studying the expectation of college graduation am…
delimiters not recognized by stata when importing txtDear statalist, I have a txt file which I would like to import in stata. The delimiter I use is "§"…
how to generate the median variable by industry every 3 years?Hello everyone: I am trying to get the median of the sales growth rate for all the companies within…
Subscribe to:
Post Comments (Atom)
0 Response to How to group time data
Post a Comment