Dear all,
I am using this code to reshape data. It does reshape but the date order of the original file gets altered. i want to reshape but keep the order of date and entity intact. Kindly help me to update this code:
foreach var of varlist * {
local j = "`: variable l `var''"
local newname = strtoname("`j'", 1)
rename `var' V_`newname'
}
destring,replace
generate id = _n
reshape long V_ , i(id) j(dat) string
list, sepby(id)
Thanks in anticipation.
Related Posts with Reshape Long
generating new variable based on date variableDear Stata community, I have a variable stored as dates in the Stata format i.e 01jul1993 (I conver…
Keeping most full observation in a hierarchyHi, I have a dataset that is a hierarchy set over a maximum of 4 levels where each row is a level i…
how to make new variable based on existing variable?Hello! I have this categorical variable "education" No education 0 High School 1 Collage 2 PhD 3 …
How to generate a new variable to convert data of acres unit variable to hectares unit? (1 acre=0.4hectare)The variable on acres unit was a string variable. I encoded it and created a new numeric (float) var…
Procedure to select the variable with values closest to the values to another variableIs there any automatic procedure in Stata to do the following: I have a fairly short time-series da…
Subscribe to:
Post Comments (Atom)
0 Response to Reshape Long
Post a Comment