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
Problem why time calculationsHey i'm wondering if anyone can help ? When i'm calculating the wait time(wait_time_new) i calcula…
how to create a loop for generating dummy variables from multiple choice questionDear all, I have the following data with variable "seed_test" that have multiple answers. I would l…
Problem with dropping observations in longitudinal studyHi! I'm working with data collected in 2002 (round 1), 2007 (round 2) and 2017 (round 3). I want to…
ArdlColleagues please help me interpretation of the following results Array …
EctColleagues, please help me interpret the results of the following error correlation model Array …
Subscribe to:
Post Comments (Atom)
0 Response to Long to wide with continuous time
Post a Comment