Hello,
I'm reshaping a dataset from wide to long, and the - reshape long - command is applying a random previously undefined value label to my new j variable. This happens regardless of whether running a do file or using the menu. I'm using Stata 14 MP.
Here's a sample of what the data looks like and the code i am using. It's the same problem whether I use my entire dataset or the reduced version I show here.
br
reshape clear
reshape long x y, i(hhid) j(t)
br
desc t // the j variable now has a value and a variable label
storage display value
variable name type format label variable label
-----------------------------------------------------------------------
t byte %47.0g item Variable Name
If I try dropping the item value label before reshaping, I get an error that it does not exist.
. lab drop item
value label item not found
Has anyone encountered this before? I've never seen reshape act this way before. It's an easy fix but I wonder what is causing the issue.
Thanks,
Lily
I'm reshaping a dataset from wide to long, and the - reshape long - command is applying a random previously undefined value label to my new j variable. This happens regardless of whether running a do file or using the menu. I'm using Stata 14 MP.
Here's a sample of what the data looks like and the code i am using. It's the same problem whether I use my entire dataset or the reduced version I show here.
br
hhid | x1 | y1 | x2 | y2 | x3 | y3 | x4 | y4 | x5 | y5 |
001 | 3.945205 | No | 6.082192 | No | 9.008219 | No | 11.90137 | No | 17.95069 | Yes |
002 | 3.912329 | No | 6.049315 | No | 9.008219 | No | 11.96712 | No | 17.91781 | Yes |
003 | 3.945205 | No | 5.983562 | No | 8.975343 | No | 12.23014 | No | 17.95069 | Yes |
reshape clear
reshape long x y, i(hhid) j(t)
br
hhid | t | x | y |
001 | Books | 3.945205 | No |
001 | Pots | 6.082192 | No |
001 | Plates from clay /plastic/tin | 9.008219 | No |
001 | Cutlery | 11.90137 | No |
001 | Containers to carry water (clay pot/jar, basin) | 17.95069 | Yes |
002 | Books | 3.912329 | No |
002 | Pots | 6.049315 | No |
002 | Plates from clay /plastic/tin | 9.008219 | No |
002 | Cutlery | 11.96712 | No |
002 | Containers to carry water (clay pot/jar, basin) | 17.91781 | Yes |
003 | Books | 3.945205 | No |
003 | Pots | 5.983562 | No |
003 | Plates from clay /plastic/tin | 8.975343 | No |
003 | Cutlery | 12.23014 | No |
003 | Containers to carry water (clay pot/jar, basin) | 17.95069 | Yes |
desc t // the j variable now has a value and a variable label
storage display value
variable name type format label variable label
-----------------------------------------------------------------------
t byte %47.0g item Variable Name
If I try dropping the item value label before reshaping, I get an error that it does not exist.
. lab drop item
value label item not found
Has anyone encountered this before? I've never seen reshape act this way before. It's an easy fix but I wonder what is causing the issue.
Thanks,
Lily
Comment