I'd like to reshape this dataset.
When I try this, using greshape
Stata returns
But when I do
It works correctly. Why? And what might the fix for this be?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float time double cf_2 float(relative_2 diff_2 te_ub te_lb) double cf_7 float(relative_7 diff_7) double cf_17 float(relative_17 diff_17) 193 5.282966605930639 -37 -.18137263 .9643626 -1.3271078 6.59757642203931 -37 .017612653 4.093034561446248 -37 -.003218468 194 5.220879939670351 -36 .019524666 1.1652598 -1.1262106 6.547392159706774 -36 .14655706 3.919490818169125 -36 .2373495 195 5.252170717491478 -35 -.21699777 .9287374 -1.362733 6.5142955300359535 -35 -.11739583 3.7529658132272203 -35 .08740246 196 5.195689556152522 -34 -.2410816 .9046536 -1.3868167 6.4494537874063935 -34 .2786136 3.6369668696814275 -34 .10042413 197 5.359129502628014 -33 -.05335005 1.0923852 -1.1990852 6.6490847053730455 -33 .019785266 3.850225651832311 -33 -.0209653 198 5.487136044786211 -32 .0388244 1.1845596 -1.1069108 6.708450181069689 -32 -.034400325 3.753413918287599 -32 -.01330209 199 5.571647188747559 -31 -.12390759 1.0218276 -1.2696427 6.756333682363369 -31 -.02909598 3.80694788079737 -31 -.0928294 200 5.47864186005766 -30 -.16858326 .9771519 -1.3143184 6.722987148826959 -30 -.3251652 3.673072642201028 -30 -.0501352 201 5.437423332720342 -29 -.11460648 1.0311286 -1.2603416 6.686096615909644 -29 -.074493356 3.79427259648948 -29 -.27745026 202 5.28074701685596 -28 -.10110005 1.0446352 -1.2468352 6.543743415209481 -28 -.18287782 3.676413550221301 -28 -.2633977 203 5.309166490084527 -27 -.0033126464 1.1424226 -1.1490479 6.54339432435244 -27 -.14157462 3.5476113927756767 -27 -.27269712 204 5.236153728270815 -26 -.16626227 .9794729 -1.3119974 6.469101968920353 -26 -.03249127 3.462803403388625 -26 -.1491063 205 5.167449361048614 -25 -.3409704 .8047648 -1.4867055 6.464428309333178 -25 -.07866895 3.5330889142176023 -25 -.12927483 206 5.015711914127917 -24 -.3650519 .7806833 -1.510787 6.307631171655488 -24 -.23327842 3.570718845107996 -24 -.1950899 207 4.967182619462756 -23 -.0945897 1.0511454 -1.240325 6.283824033581693 -23 -.20573145 3.4041504459157808 -23 -.07909318 208 4.879279026233051 -22 -.27591598 .8698192 -1.421651 6.17822029139363 -22 -.13299228 3.2686992703925424 -22 -.08499514 209 4.947852152794563 -21 -.31172135 .8340138 -1.4574566 6.193709047514927 -21 .0759891 3.5583066214483985 -21 -.05898802 210 4.664941616468249 -20 -.1677998 .9779354 -1.313535 6.008457322955599 -20 -.4125711 3.5199623628316696 -20 .017445989 211 4.587397079990673 -19 -.0786662 1.0670689 -1.2244014 5.932349991445613 -19 -.6780446 3.679448931260275 -19 -.02726492 212 4.684253175495709 -18 -.030148465 1.1155868 -1.1758837 6.076093679096494 -18 -.308342 3.533573072244473 -18 .17675216 213 4.893568810123201 -17 -.20294553 .9427897 -1.3486807 6.248096516272423 -17 .0474853 3.657513520612717 -17 -.04229631 214 4.800380451824756 -16 -.1959698 .9497654 -1.341705 6.16174173104781 -16 -.07867289 3.617417708909943 -16 .1654886 215 4.9447305537250505 -15 -.18439367 .9613415 -1.330129 6.247382353349807 -15 .21564274 3.8922666378134556 -15 -.320629 216 5.111348919350792 -14 -.24082546 .9049097 -1.3865607 6.447360369966539 -14 .0002233054 3.9237824476372047 -14 -.04791437 217 5.382460978668835 -13 -.50167596 .6440592 -1.647411 6.696408060879917 -13 .13170883 4.064839600544477 -13 -.0033705225 218 5.504403718222508 -12 .04244029 1.1881754 -1.1032948 6.866874503454819 -12 .02061911 4.103998550846539 -12 .23118316 219 6.002193170678932 -11 .7475107 1.893246 -.3982244 7.12112433740039 -11 .10598462 4.228122619416967 -11 -.2122449 220 10.937222851827093 -10 -.15422095 .9915142 -1.299956 11.507429212305944 -10 -.09312925 8.592658674146811 -10 .027830446 221 11.38529218536622 -9 .22185217 1.3675873 -.923883 11.924041218372235 -9 .4273992 9.140783934360117 -9 -.06386915 222 11.80954936539679 -8 .036493268 1.1822284 -1.109242 12.279772784486859 -8 .57887936 9.481274355319457 -8 .03900648 223 12.226560463261468 -7 .51172936 1.6574645 -.6340058 12.626181405346014 -7 .08743687 9.785985574613868 -7 .15373267 224 12.751570432839207 -6 .5951484 1.7408836 -.5505868 13.115387156711048 -6 -.0292408 10.27054002426071 -6 .08816645 225 13.20590537258044 -5 .3589559 1.504691 -.7867793 13.616813832868445 -5 .10653097 10.777237236580406 -5 .08437413 226 13.660462860041042 -4 .29201937 1.4377545 -.8537158 14.058503789556916 -4 .12998994 11.043653581547906 -4 -.1836606 227 14.16875966782095 -3 .51493424 1.6606694 -.630801 14.600333855374384 -3 .04707368 11.329495568476105 -3 .4218892 228 14.680327341325036 -2 .5902081 1.7359433 -.5555271 15.04410089108464 -2 .28803146 11.866782668775379 -2 .3841786 229 15.29093568436928 -1 .54582864 1.691564 -.5999066 15.608327302310041 -1 .4626032 12.241359782953616 -1 .3765687 230 15.667054911993288 0 .8554003 2.0011356 -.29033485 16.00192379026954 0 .3142135 12.433585510871174 0 .6495844 231 15.92571512292801 1 2.5558674 3.701603 1.4101323 16.66329733969614 1 -3.644054 12.643606663508233 1 1.6535716 232 16.293280003396173 2 2.1945646 3.3403 1.0488294 16.97255087704527 2 -3.47776 12.764091405237153 2 1.812603 233 16.711950045562038 3 2.261101 3.406836 1.1153659 17.382916936242363 3 -2.99445 13.163676858064562 3 1.6748613 234 16.731234755995207 4 1.8978755 3.043611 .7521403 17.380718193582947 4 -2.675229 13.218499447886247 4 1.651323 235 17.05620438831284 5 2.2418265 3.387562 1.0960914 17.626517226693718 5 -2.6396666 13.396059273265253 5 1.4180124 236 17.727221821551957 6 1.9428812 3.0886164 .797146 18.266470519259713 6 -2.492863 13.821394185878402 6 1.5337417 end format %tq time
Code:
qui greshape long diff_ te_lb_ te_ub_ cf_ relative_, i(time) j(code) // using the good reshape!
Code:
"CheckVariableTypes(): 3301 subscript invalid <istmt>: - function returned error r(3301);
Code:
qui reshape long diff_ te_lb_ te_ub_ cf_ relative_, i(time) j(code) // using the slow reshape!
Comment