Hi @ErikLund_Jensen , Thank you so much for your kind reply. I am so sorry that I am not clear enough. Actually, I just want to fill the variables with few missing values. For example, the number of the missing value of value1 of firm A is 10, so I ignore it. Firm A, the number of the missing value of value1 is 10, not fill it. The number of the missing value of value 2 is 3, fill it. The number of the missing value of value 3 of firm A is 5, so should also not be filled. Firm B, the number of the missing value of value1 is 3, fill it. The number of the missing value of value 2 is 4, fill it. The number of the missing value of value 3 is 4, fill it. Hope this time my explanation would be clearer, and thanks again for your quick reply. Thank you, Hui data test;
input firm $2. year Month value1 value2 value3;
cards;A 2006 03 7 7 5
A 2006 03 8 8 .
A 2006 03 . 9 1
A 2006 06 5 . .
A 2006 06 8 7 4
A 2006 06 . 4 3
A 2006 09 . . 2
A 2006 09 9 7 1
A 2006 09 . . 5
A 2007 03 . 7 .
A 2007 03 . 7 8
A 2007 03 . 7 .
A 2007 06 . 3 2
A 2007 06 . 7 6
A 2007 06 . 8 .
B 2006 03 . 2 1
B 2006 03 12 7 .
B 2006 03 10 . .
B 2007 03 9 1 2
B 2007 03 1 . .
B 2007 03 . 3 4
B 2007 03 . . .
B 2007 03 . 3 4;
run; data want; A 2006 03 7 7 5
A 2006 03 8 8 .
A 2006 03 . 9 1
A 2006 06 5 9 .
A 2006 06 8 7 4
A 2006 06 . 4 3
A 2006 09 . 4 2
A 2006 09 9 7 1
A 2006 09 . 7 5
A 2007 03 . 7 .
A 2007 03 . 7 8
A 2007 03 . 7 .
A 2007 06 . 3 2
A 2007 06 . 7 6
A 2007 06 . 8 .
B 2006 03 . 2 1
B 2006 03 12 7 1
B 2006 03 10 7 1
B 2007 03 9 1 2
B 2007 03 1 1 2
B 2007 03 1 3 4
B 2007 03 1 3 4
B 2007 03 1 3 4
... View more