With the following dataset, how do you code a macro that will create variables per ID that reports the values for each variable (bp, weight, bc) that corresponds to the last form_number? And keep the original variable in the dataset? The number of forms per ID may vary. data test, input ID$ bp weight bc form_number; datalines; 1 120 78 178 1 1 134 80 177 2 1 143 . 176 3 2 111 58 . 1 3 154 55 160 1 3 178 56 144 2 ; run; what we need is the following new dataset: ID bp weight bc form_number late_bp late_weight late_bc 1 120 78 178 1 143 80 176 1 134 80 177 2 . . . 1 143 . 176 3 . . . 2 111 58 . 1 111 58 . 3 154 55 160 1 178 56 144 3 178 56 144 2 . . .
... View more