Hi everyone,
I am looking for a way to convert a dataset from the long format to a wide format. However, I only have time as a continuous variable in weeks at multiple dp.
I can't figure out how to assign a visit variable via a code. I mean I can do it manually, but there's I have a large N.
Below is an example of 10 observations from the dataset:
id week age sex
1 0 36.4271 Male
1 7.5714 36.4271 Male
1 15.5714 36.4271 Male
1 23.5714 36.4271 Male
1 32.5714 36.4271 Male
1 40 36.4271 Male
2 0 47.8467 Male
2 8 47.8467 Male
2 16 47.8467 Male
2 23 47.8467 Male
2 30.7143 47.8467 Male
2 39 47.8467 Male
3 0 60.2875 Male
4 0 36.5969 Male
4 7.1429 36.5969 Male
4 16.1429 36.5969 Male
4 32.4286 36.5969 Male
5 0 35.948 Male
5 8 35.948 Male
5 16 35.948 Male
5 24 35.948 Male
5 32 35.948 Male
5 40 35.948 Male
Any help or guidance will be much appreciated. I am using stata v17.
Related Posts with Long to wide with continuous time
mhodds and test for trendDear Listers, I am considering using the -mhodds- command for an expvar with more than 2 levels in …
Choosing reference/base periods in panel data and normalizing the corresponding coefficient to zeroHi I am looking to do two things with a panel dataset (c350 firms and annual data from 2008 to 2016…
Including lags in a xtreg regressionHello, I have a panel dataset containing quarterly data from 2000-2016. I want to do a regression w…
Error in finding host for ssc package downloadHi all, I'm currently working on my thesis with the Abadie-Imbens estimator and have been using Sta…
Regression with change relative to base yearHello! I am sorry if this topic came up before, I tried searching for answers but without luck. I ha…
Subscribe to:
Post Comments (Atom)
0 Response to Long to wide with continuous time
Post a Comment