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
What does dot mean in correlation matrix?Hi all, when running correlation matrix, I face the situation that the correlation is ".", I am won…
Help obtaining number of previous appearances of unique ID within designated timeframeHello all, I have a "date" variable and an "ID" variable for a number of observations. I want to g…
STATA slowness or problems in my data?Dear STATA users, I am writing to ask for a general opinion on STATA. I am running a logistic multil…
Need help combining my race variables into one categorical variableHi, I am new to stata and need help with the above complaints. I have data that has a variable for …
Is it possible to combine binscatter and vioplot?Vioplot works on categorial x axis. binscatter makes continuous, discrete. I am looking to have a hi…
Subscribe to:
Post Comments (Atom)
0 Response to Turn categorical variables into separate columns
Post a Comment