Hey there, I like to create a new column indicating the occurrence of non-missing BAM within each id. For example, a new column named "BAM_panel" to start from 1-6 for id 3. Simply put, I want a panel index for BAM within each id when it is not missing. Would you help out? Thanks very much!

Code:
clear
input int id float BAM
3   5
3   2
3   7
3  -6
3   1
3  -4
3   .
4   8
4  21
4   6
4  11
4   2
4  -1
4  -2
4 -15
4  -1
4   4
4   4
4   6
4  11
4  11
4  22
4   7
4  28
4   4
4   8
4   7
4   7
4  35
4  16
4   4
4   7
4  10
4   1
4  -7
4  -5
4   3
4   7
4   8
4  35
4   6
4  10
4   3
4   1
4  -7
4   4
4  -5
4   7
4  -5
4   1
4  -1
4   3
4  -2
4   .
7   .
end