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
Significance levels of combined coefficientsDear Stata users, My regression looks as follows: y = x0 x1 x2 x3 x4 x5 Where x4 = x3 * dummy (ind…
ML estimation goes forever in longitudinal analysisHi statisticians, I am running a saturated model (-mixed-) for preliminarily assess the effect of i…
LCA gsem output tables and intercept significanceHello dear all, I was trying to understand the output tables especially the first one, mlogit model …
Stata update error: 'Could not move java to .old/' r(695)Greetings, I'm running Stata 15.1 on OSX. I really bought a new computer and (using OSX's 'migratio…
geodist - calculating distanceHi Statalists, I have data with id (i.e. addresses), year (i.e. 2006, 2007 and 2008), devision (i.e…
Subscribe to:
Post Comments (Atom)
0 Response to Turn categorical variables into separate columns
Post a Comment