Hey everyone,
I need your advice. I want to reshape my indices to long form. Basically I need the file to look like this in the end (this is an example data)
This is how I prepare the data in excel
But when I import it to STATA it turns into this (I think it's because there are multiple same variable name)
So when I use this formula
It didn't turn out as I wanted, since the renamed variable (v3, v4, v5, ...) stayed as variable on top and not being transformed...
I have around 10,000 variables (so it goes until v8000 or something), so I'm afraid doing it manually one buy one is not a very good option.
I tried renaming the variable with it's label using forearch, but it doesn't work.
Thank you.
EDIT:
Result of -describe-
I don't think that it violates the variable name rules (no spaces, no non-alphanumeric characters, and none of them exceed 15 characters)
Result from running -dataex-
I need your advice. I want to reshape my indices to long form. Basically I need the file to look like this in the end (this is an example data)
This is how I prepare the data in excel
But when I import it to STATA it turns into this (I think it's because there are multiple same variable name)
So when I use this formula
Code:
reshape long index, i(sdate) j(reference1) string
I have around 10,000 variables (so it goes until v8000 or something), so I'm afraid doing it manually one buy one is not a very good option.
I tried renaming the variable with it's label using forearch, but it doesn't work.
Code:
foreach v of varlist var1 var2 var3 { local x : variable label `v' rename `v' `x' }
Thank you.
EDIT:
Result of -describe-
Code:
v8209 float %9.0g indexspcomp v8210 float %9.0g indexspcomp v8211 float %9.0g indexspcomp v8212 float %9.0g indexhngkngi v8213 float %9.0g indexftallsh v8214 float %9.0g indexspcomp v8215 float %9.0g indexibex35i v8216 float %9.0g indexftallsh v8217 float %9.0g indexftallsh v8218 float %9.0g indexftallsh v8219 float %9.0g indexspcomp v8220 float %9.0g indexspcomp v8221 float %9.0g indexspcomp v8222 float %9.0g indexspcomp
Result from running -dataex-
Code:
. dataex input statement exceeds linesize limit. Try specifying fewer variables
Comment