Hello Stata community,
I am looking to duplicate the time observations in a panel data 17 times, whiles keeping the data in long-format in Stata. I have tried the following commands:
expandby 17, by(id) sort(time)
expandby 17, by(id) sort()
In either case, only the last year is duplicated for each country or some years’ observations are duplicated. I would appreciate your feedback on the right code to use
Thanks,
Rex
Related Posts with Duplicating time observations in panel data in stata
generate random number using loopforv i = 1/10{ if mod(`i',2)==0 gen z`i' = rnormal() if mod(`i',2)==1 gen z`i' = runiform() } i want…
How to export difference-in-differences table from Stata to Latex?I'm trying to export the results from a difference-in-differences from Stata to Latex. I tried the f…
Between Group Baseline Difference in Randomized Control Trial?I know many of you are much smarter than I.. I'm analyzing data for an RCT with relatively small n (…
Making long labels wrap into two lines using esttab on latexHi all, I am trying to tabulate some variables and export the data to latex using esttab (command f…
Customizing legend of twoway graph.Dear All, I am making a twoway graph as follows: Code: twoway (scatter daysMED week if dateWeek&…
Subscribe to:
Post Comments (Atom)
0 Response to Duplicating time observations in panel data in stata
Post a Comment