Dear members,
I'm stuck on a data reshaping problem. I'm including an example data to ease your understanding.
The initial data I have is as follows:
clear all
input float(s_id year value) strL(s_name)
90 85 20.5 weight
90 86 28.9 weight
91 85 39.4 weight
91 86 54.4 weight
90 85 30.1 height
90 86 30.2 height
91 85 45.6 height
91 86 43.4 height
90 85 60.1 dist
90 86 70.1 dist
91 85 81.2 dist
91 86 43.6 dist
end
I would like to reshape it such that I create new columns of weight height and dist.
clear all
input float(s_id year weight height dist)
90 85 20.5 30.1 60.1
90 86 28.9 30.2 70.1
91 85 39.4 45.6 81.2
91 86 54.4 43.4 43.6
end
Any help is much appreciated! Thank you.
Related Posts with Turn categorical variables into separate columns
reshaping in stataI have some data in which I have for each row the data by center, and I need to have them by student…
Panel data analysis using xtabond2I have got the following result. is that okay Array Please help me. …
Single effect estimate for a categorical interaction term?!hi all! I'm working on a project looking at the effect of an intervention on a continuous outcome v…
Create a loop for regressionsGood morning everybody, I have a dataset with 150 variables and I would like to create a loop to pe…
invalid numlist for synth commandHi, I am working with the synthetic control method with the data being spaced unevenly over the year…
Subscribe to:
Post Comments (Atom)
0 Response to Turn categorical variables into separate columns
Post a Comment