i assume your dates are either 2003-6-30 or 2003-3-31, and you consider the difference for the same jjdm. also, i assume that given the same jjdm, there will be only ONE date for each gpmc.
* step 1:
bys jjdm gpmc (date): gen x=cgsl-cgsl[_n-1]
jjdm date cgsl gpmc x
184688 3/31/2003 75866 a
184688 6/30/2003 1300000 a 1224134
184688 3/31/2003 7586 b
184688 6/30/2003 12614982 b 1.26E+07
184688 3/31/2003 85960 c
184688 6/30/2003 448284 c 362324
184688 3/31/2003 289560 d
184688 6/30/2003 2000000 d 1710440
184688 3/31/2003 274859 e
184688 6/30/2003 3126243 e 2851384
184688 3/31/2003 2875996 f
184688 3/31/2003 8567 f -2867429
184688 3/31/2003 12614982 g
184688 3/31/2003 464669 g -1.22E+07
184688 3/31/2003 3758569 h
184688 6/30/2003 3000000 h -758569
184688 6/30/2003 700000 i
184688 6/30/2003 1700000 i 1000000
184688 6/30/2003 526363 j
184688 6/30/2003 1590851 j 1064488
* if you want to set the same x value for the same jjdm and gpmc, then:
bys jjdm gpmc (x): replace x=x[1]
* step 2:
Now, you can set the rest of x to 0:
replace x=0 if x==.
hope this helps