I want to know how to replace the missing values for other groups (by mdate) with the values of group 1 in case of mk and ex variable which are same for all groups. Each group is identified by the stock_id. The illustrative data example is appended.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(date mdate) byte stock_id float rt byte mk int ex 22281 732 1 .21 20 101 22312 733 1 .23 30 255 22340 734 1 .01 40 62 22371 735 1 .27 50 7 22281 732 2 1.21 . . 22312 733 2 2.52 . . 22340 734 2 1.11 . . 22371 735 2 .78 . . 22281 732 3 3.55 . . 22312 733 3 .99 . . 22340 734 3 1.76 . . 22371 735 3 .29 . . end format %td date format %tm mdate
Comment