Hi,

I would like to start counter counting missing values after each non-missing value by group (unit_id)

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double unit_id float date_earn_q double WC01001
1 432  664406
1 433       .
1 434       .
1 435       .
1 436       .
1 437       .
1 438       .
1 439       .
1 440       .
1 441       .
1 442       .
1 443       .
1 444  721947
1 445       .
1 446       .
1 447       .
1 448       .
1 449       .
1 450       .
1 451       .
1 452       .
1 453       .
1 454       .
1 455       .
1 456  900863
1 457       .
1 458       .
1 459       .
1 460       .
1 461       .
1 462       .
1 463       .
1 464       .
1 465       .
1 466       .
1 467       .
1 468 1057691
1 469       .
1 470       .
1 471       .
1 472       .
1 473       .
1 474       .
1 475       .
1 476       .
1 477       .
1 478       .
1 479       .
1 480 1258827
1 481       .
1 482       .
1 483       .
1 484       .
1 485       .
1 486       .
1 487       .
1 488       .
1 489       .
1 490       .
1 491       .
1 492 1333000
1 493       .
1 494       .
1 495       .
1 496       .
1 497       .
1 498       .
1 499       .
1 500       .
1 501       .
1 502       .
1 503       .
1 504 1505691
1 505       .
1 506       .
1 507       .
1 508       .
1 509       .
1 510       .
1 511       .
1 512       .
1 513       .
1 514       .
1 515       .
1 516 1497101
1 517       .
1 518       .
1 519       .
1 520       .
1 521       .
1 522       .
1 523       .
1 524       .
1 525       .
1 526       .
1 527       .
1 528       .
1 529 1711453
1 530       .
1 531       .
end
format %tm date_earn_q
label values unit_id unit_id
label def unit_id 1 "130062", modify
Here is what I would like to obtain (done manually here):
Array

Can someone help me with that? Thanks.