I am trying to reshape a set of variables on the second duplicated row. c11-17 correspond to the CLL FISH (first row data corresponding to path c) while t11-t18 corresponds to the transformation data (path 't') that should only be in the second row stacked below c11-c17 but with t8 and t18 being blank for the first id. I tried reshape and stack without success, but I guess destination cells need to be empty. I smell a bys and foreach but cant figure out a logical way to replace.
Stack row2 of tt11-t17 below first row of c11-c17, deleting any data in the destination is what I want to code to do.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int studyid str1 path byte(c11 c12 c13 c14 c17 t11 t12 t13 t14 t17 t8 t18) 104 "c" . . . . . . . . . . . . 104 "t" . . . . . . . . . . . . 105 "c" . . . . . 2 1 1 1 2 2 1 105 "t" . . . . . 2 1 1 1 2 2 1 106 "c" 1 1 2 1 1 . . . . . 2 . 106 "t" 1 1 2 1 1 . . . . . 2 . 107 "c" 1 1 1 2 2 . . . . . 2 . 107 "t" 1 1 1 2 2 . . . . . 2 . 108 "c" 1 2 2 . 2 . . . . . 2 . 108 "t" 1 2 2 . 2 . . . . . 2 . 109 "c" . . . . . . . . . . 2 . 109 "t" . . . . . . . . . . 2 . 110 "c" 1 1 2 1 1 . . . . . 2 . 110 "t" 1 1 2 1 1 . . . . . 2 . 111 "c" . . . . . . . . . . 2 . 111 "t" . . . . . . . . . . 2 . 112 "c" . . . . . . . . . . . . 112 "t" . . . . . . . . . . . . 113 "c" 1 2 1 1 2 . . . . . 2 . 113 "t" 1 2 1 1 2 . . . . . 2 . 114 "c" 1 1 2 1 1 . . . . . 2 . 114 "t" 1 1 2 1 1 . . . . . 2 . 115 "c" 2 2 1 1 1 . . . . . . . 115 "t" 2 2 1 1 1 . . . . . . . 116 "c" 1 2 1 1 1 . . . . . 2 . 116 "t" 1 2 1 1 1 . . . . . 2 . 117 "c" 1 2 1 1 1 2 2 1 . 2 2 1 117 "t" 1 2 1 1 1 2 2 1 . 2 2 1 118 "c" . 2 . . . . . . . . 2 . 118 "t" . 2 . . . . . . . . 2 . 119 "c" 1 1 2 1 1 . . . . . . . 119 "t" 1 1 2 1 1 . . . . . . . 120 "c" 1 2 1 1 2 . . . . . 2 . 120 "t" 1 2 1 1 2 . . . . . 2 . 121 "c" . . . . . . . . . 2 . . 121 "t" . . . . . . . . . 2 . . 122 "c" . . . . 1 . . . . . . . 122 "t" . . . . 1 . . . . . . . 123 "c" 1 1 2 1 2 1 1 2 1 2 . 1 123 "t" 1 1 2 1 2 1 1 2 1 2 . 1 124 "c" 2 2 1 1 1 2 2 1 1 1 . . 124 "t" 2 2 1 1 1 2 2 1 1 1 . . 125 "c" 1 1 1 1 2 1 1 1 1 2 2 . 125 "t" 1 1 1 1 2 1 1 1 1 2 2 . 126 "c" . . . . . . . . . . 3 . 126 "t" . . . . . . . . . . 3 . 127 "c" 1 1 1 1 1 1 1 1 1 1 2 . 127 "t" 1 1 1 1 1 1 1 1 1 1 2 . 128 "c" 1 1 1 1 2 . . . . . 2 1 128 "t" 1 1 1 1 2 . . . . . 2 1 129 "c" 1 2 1 1 1 1 1 2 1 2 2 1 129 "t" 1 2 1 1 1 1 1 2 1 2 2 1 130 "c" 1 1 2 2 1 1 1 2 1 2 2 1 130 "t" 1 1 2 2 1 1 1 2 1 2 2 1 131 "c" 1 2 1 1 2 1 2 2 1 2 . . 131 "t" 1 2 1 1 2 1 2 2 1 2 . . 132 "c" 1 1 2 1 2 . . . . . . . 132 "t" 1 1 2 1 2 . . . . . . . 133 "c" . . . . . . . . . . . . 133 "t" . . . . . . . . . . . . 134 "c" 2 2 2 1 1 2 2 2 1 1 2 . 134 "t" 2 2 2 1 1 2 2 2 1 1 2 . 135 "c" 1 1 1 1 2 . . . . . . . 135 "t" 1 1 1 1 2 . . . . . . . 136 "c" 1 2 1 1 1 1 1 1 1 1 . . 136 "t" 1 2 1 1 1 1 1 1 1 1 . . 137 "c" 1 1 2 1 1 . . . . . . . 137 "t" 1 1 2 1 1 . . . . . . . 138 "c" . . . . . . . . . . 1 . 138 "t" . . . . . . . . . . 1 . 139 "c" 1 1 1 1 1 2 1 2 1 2 . . 139 "t" 1 1 1 1 1 2 1 2 1 2 . . 140 "c" . . . . . . . . . . . . 140 "t" . . . . . . . . . . . . 141 "c" 1 1 2 2 1 1 1 2 2 2 . . 141 "t" 1 1 2 2 1 1 1 2 2 2 . . 142 "c" 1 1 2 1 1 . . . . . 3 1 142 "t" 1 1 2 1 1 . . . . . 3 1 143 "c" . . . . . . . . . . 3 . 143 "t" . . . . . . . . . . 3 . 144 "c" . . . . . . . . . . . . 144 "t" . . . . . . . . . . . . 145 "c" . . 2 . . . . . . . . . 145 "t" . . 2 . . . . . . . . . 146 "c" . . . . 2 . . . . . . . 146 "t" . . . . 2 . . . . . . . 147 "c" . . 2 1 2 1 1 1 1 1 . . 147 "t" . . 2 1 2 1 1 1 1 1 . . 148 "c" 1 2 1 2 1 . . . . . . . 148 "t" 1 2 1 2 1 . . . . . . . 149 "c" . . . . . . . . . . . . 149 "t" . . . . . . . . . . . . 150 "c" . . . . . 1 1 1 1 1 2 1 150 "t" . . . . . 1 1 1 1 1 2 1 151 "c" 2 1 1 1 1 . . . 1 . 2 1 151 "t" 2 1 1 1 1 . . . 1 . 2 1 end label values c11 _cll_fatm label def _cll_fatm 1 "NEGATIVE", modify label def _cll_fatm 2 "POSITIVE", modify label values c12 _cll_f12 label def _cll_f12 1 "NEGATIVE", modify label def _cll_f12 2 "POSITIVE", modify label values c13 _cll_f13 label def _cll_f13 1 "NEGATIVE", modify label def _cll_f13 2 "POSITIVE", modify label values c14 _cll_figh label def _cll_figh 1 "NEGATIVE", modify label def _cll_figh 2 "POSITIVE", modify label values c17 _cll_fp53 label def _cll_fp53 1 "NEGATIVE", modify label def _cll_fp53 2 "POSITIVE", modify label values t11 rtsf11q label def rtsf11q 1 "NEGATIVE", modify label def rtsf11q 2 "POSITIVE", modify label values t12 rtsf12 label def rtsf12 1 "NEGATIVE", modify label def rtsf12 2 "POSITIVE", modify label values t13 rtsf13q label def rtsf13q 1 "NEGATIVE", modify label def rtsf13q 2 "POSITIVE", modify label values t14 rtsfigh label def rtsfigh 1 "NEGATIVE", modify label def rtsfigh 2 "POSITIVE", modify label values t17 rtsf53 label def rtsf53 1 "NEGATIVE", modify label def rtsf53 2 "POSITIVE", modify label values t8 rtsfmyc label def rtsfmyc 1 "GAINS", modify label def rtsfmyc 2 "NEGATIVE", modify label def rtsfmyc 3 "POSITIVE", modify label values t18 rtsfbcl2 label def rtsfbcl2 1 "NEGATIVE", modify
0 Response to Reshape vs stack help
Post a Comment