I am working with panel data, and I would like to ask you again for help.
I would like to replace missing values in master data with values from using data, based on time criterion.
Master file Merging.dta
Code:
clear input double(crsp_fundno crsp_portno) float mofd 1788 . 405 1788 . 406 1788 . 407 1788 . 408 1788 . 409 1788 . 410 1788 . 411 1788 . 412 1788 . 413 1788 . 414 1788 . 415 1788 . 416 1788 . 417 1788 . 418 1788 . 419 1788 . 420 1788 . 421 1788 . 422 1788 . 423 1788 . 424 1788 . 425 .... . ... 1788 . 600 1788 . 601 1788 . 602 1788 . 603 1788 . 604 1788 . 605 1788 . 606 end
Code:
clear input double(crsp_fundno crsp_portno) float(begmofd endmofd) 1788 1009555 582 604 1788 1023119 605 740 2118 1028804 611 740 end
Endmofd - ending month
As in the example above of the using file, the data shows that a different crsp_portno can apply to the same crsp_fundno, but over different time period. Some crsp_fundnos can have only one range.
The example of the master file is an extreme one, as the the earliest time record is 405, which is outside of the 582-604 month range. Although 405 is lower than 582, I still would like to replace those missing crsp_portno values from master file with the crsp_portno from the using file, using the lower range.
May I kindly ask you to tell me how should I perform it? I have never before run such a command, and therefore it seems quite complex for me.
Thank you very much for any help or advice!
Best,
RafaĆ
0 Response to Replacing missing values with criterion
Post a Comment