I generate this variable based on the following three variables: hours, minutes and days (frequency per month).
1) total minutes per care day
2) total minutes per month
3) total hours per month
1) generate padlhrsrevis=(rudpadlhrs_*60+rudpadlmin_)
2) gen padltotmin=(rudpadlhrs_*60+rudpadlmin_)*rudpadlday s_
3) gen padlhrsmonth= padltotmin/60
*Note: Abbreviations: RUD - Resource utilization dementia, PADL - personal actvivities of daily living
2) gen padltotmin=(rudpadlhrs_*60+rudpadlmin_)*rudpadlday s_
3) gen padlhrsmonth= padltotmin/60
*Note: Abbreviations: RUD - Resource utilization dementia, PADL - personal actvivities of daily living
See an excerpt (N=200) om my data below, and see specifically row 191 for an example. If I got missing hours, and the values 30 minutes and 4 days - it will show missing in variable 3) total hours of care per month. However, if hours is 0, this would still generate the correct value 2 hours per month.
Thus, I'm kindly asking if anyone have suggestions on how I can solve this, though - my approach is probably not the most sophisticated one
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id_real rudpadlhrs_new) byte rudpadlmin_ int rudpadldays_ float(padlhrsrevis_new padltotmin_new padlhrsmonth_new) 1 0 0 0 0 0 0 2 . . 30 . . . 3 0 20 7 20 140 2.3333333 4 1 0 7 60 420 7 5 0 0 0 0 0 0 6 . . . . . . 7 2 0 30 120 3600 60 8 . . . . . . 9 1 30 12 90 1080 18 10 0 0 0 0 0 0 11 . . 15 . . . 12 0 0 0 0 0 0 13 0 0 0 0 0 0 14 0 10 8 10 80 1.3333334 15 0 0 1 0 0 0 16 0 0 0 0 0 0 17 0 0 30 0 0 0 18 . . 30 . . . 19 0 0 8 0 0 0 20 2 30 12 150 1800 30 21 0 0 8 0 0 0 22 . . 30 . . . 23 . . 31 . . . 24 0 0 0 0 0 0 25 . . 0 . . . 26 1 0 30 60 1800 30 27 . . 0 . . . 28 . . 12 . . . 29 0 0 0 0 0 0 30 . . 15 . . . 31 3 0 30 180 5400 90 32 4.5 0 30 270 8100 135 34 . . 0 . . . 35 0 0 0 0 0 0 36 0 0 0 0 0 0 37 0 0 0 0 0 0 38 . . 9 . . . 39 . . 30 . . . 40 . . 30 . . . 41 . . 0 . . . 42 . . 3 . . . 43 0 0 0 0 0 0 44 1 30 30 90 2700 45 45 0 0 0 0 0 0 46 0 0 0 0 0 0 47 . . . . . . 48 0 0 7 0 0 0 49 0 20 20 20 400 6.666667 50 0 0 0 0 0 0 51 0 0 0 0 0 0 52 0 0 0 0 0 0 53 0 0 0 0 0 0 54 0 0 0 0 0 0 55 0 0 0 0 0 0 56 0 0 30 0 0 0 57 0 0 0 0 0 0 58 0 0 0 0 0 0 59 . . 30 . . . 60 0 0 0 0 0 0 61 0 30 20 30 600 10 62 . . 30 . . . 63 4 30 30 270 8100 135 64 0 0 0 0 0 0 65 0 0 0 0 0 0 66 0 0 0 0 0 0 67 0 45 30 45 1350 22.5 68 2 0 30 120 3600 60 69 0 0 0 0 0 0 70 2 0 7 120 840 14 71 0 0 0 0 0 0 72 2 0 7 120 840 14 73 0 0 0 0 0 0 74 0 0 0 0 0 0 75 0 0 0 0 0 0 76 0 0 0 0 0 0 77 . . 0 . . . 78 1 30 30 90 2700 45 79 2 30 12 150 1800 30 80 0 0 0 0 0 0 81 0 0 0 0 0 0 82 . . 8 . . . 83 0 0 0 0 0 0 84 0 0 0 0 0 0 85 . . 30 . . . 86 0 0 0 0 0 0 87 0 0 0 0 0 0 88 0 5 8 5 40 .6666667 89 0 0 0 0 0 0 90 . . . . . . 91 . . 30 . . . 92 . . 30 . . . 93 1 30 30 90 2700 45 94 . . 30 . . . 95 . . 0 . . . 96 0 0 0 0 0 0 97 . . 30 . . . 98 3 5 30 185 5550 92.5 99 1 30 30 90 2700 45 100 . 20 16 . . . 101 2 30 30 150 4500 75 102 0 0 0 0 0 0 103 . . 30 . . . 104 . . 30 . . . 105 . . 0 . . . 106 0 0 0 0 0 0 107 0 0 0 0 0 0 108 0 0 0 0 0 0 109 0 0 0 0 0 0 110 0 0 0 0 0 0 111 . . 30 . . . 112 0 0 0 0 0 0 113 . . 0 . . . 114 2 30 30 150 4500 75 115 . . 30 . . . 116 0 0 0 0 0 0 117 0 0 0 0 0 0 118 . . 0 . . . 119 . . 0 . . . 120 . . . . . . 121 . . 0 . . . 122 . . 15 . . . 123 . . 0 . . . 124 . . 0 . . . 125 . . 0 . . . 126 1 30 30 90 2700 45 127 0 0 0 0 0 0 128 0 0 . 0 . . 129 0 0 0 0 0 0 130 1 0 26 60 1560 26 131 0 0 1 0 0 0 132 . . 30 . . . 133 0 0 0 0 0 0 134 . . 0 . . . 135 . . 30 . . . 136 . . 0 . . . 137 . . 0 . . . 138 0 0 0 0 0 0 139 . . 30 . . . 140 1 0 8 60 480 8 141 0 0 0 0 0 0 142 . . 0 . . . 143 . . 0 . . . 144 0 0 0 0 0 0 145 . . 0 . . . 146 . . 4 . . . 147 . . 0 . . . 148 0 0 0 0 0 0 149 . . 30 . . . 150 . . 0 . . . 151 . . 30 . . . 152 0 0 0 0 0 0 153 . . 30 . . . 154 . . 30 . . . 155 . . 0 . . . 156 . . 0 . . . 157 . . 0 . . . 158 2 0 30 120 3600 60 159 . . 0 . . . 160 . . 0 . . . 161 0 0 0 0 0 0 162 0 0 0 0 0 0 163 . . 7 . . . 164 0 0 0 0 0 0 165 0 30 12 30 360 6 166 0 30 4 30 120 2 167 0 0 30 0 0 0 168 0 15 30 15 450 7.5 169 0 30 30 30 900 15 170 2 15 8 135 1080 18 171 3 0 30 180 5400 90 172 0 0 0 0 0 0 173 1 0 4 60 240 4 174 1 0 4 60 240 4 175 . . . . . . 176 0 0 0 0 0 0 177 0 0 0 0 0 0 178 5 0 4 300 1200 20 179 . . . . . . 180 3 0 4 180 720 12 181 . . 30 . . . 182 0 0 0 0 0 0 183 . . 2 . . . 184 0 0 0 0 0 0 185 1 0 10 60 600 10 186 . . 30 . . . 187 . . 0 . . . 188 . . 0 . . . 189 0 0 0 0 0 0 190 0 10 10 10 100 1.6666666 191 . 30 4 . . . 192 . . 4 . . . 193 2 0 4 120 480 8 194 . . 0 . . . 195 0 0 30 0 0 0 196 0 10 16 10 160 2.666667 197 0 0 0 0 0 0 198 . . . . . . 199 0 0 30 0 0 0 200 0 0 0 0 0 0 201 0 0 0 0 0 0 end
0 Response to Multiplying with missing values
Post a Comment