Dear Statalist users, following is a sample from my dataset

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float date byte stock float(silq mcap)
17899 23   -.9582806 8.895966
17899 18  -1.6167012 9.007171
17899 27  -1.5261775 9.612309
17899 38   -.3823593 9.499519
17899 22    .2282641 8.976858
17899 29  -.15126532 7.561481
17899 42  -1.9955276 7.994629
17899 20   -.8775884 7.464418
17899 31   -.9125842 7.653685
17899  3   -.1766696 7.984879
17899 30  -2.1094346 8.955536
17899 21    1.676236 9.230576
17899 11  -1.4953933 8.123054
17899 50    -.944109 6.813181
17902 23    .9651131 8.895966
17902 18   1.8163773 9.007171
17902 27   1.1801606 9.612309
17902 38    .3851524 9.499519
17902 22   .36461955 8.976858
17902 29  -1.1504817 7.561481
17902 42   1.8733516 7.994629
17902 20     .434992 7.464418
17902 31    .8395327 7.653685
17902  3 -.004479705 7.984879
17902 30   1.6301105 8.955536
17902 21   .10393868 9.230576
17902 11   -.7640229 8.123054
17902 50   .36711165 6.813181
17903 23   -.8413151 8.895966
17903 18  -.11938426 9.007171
17903 27  -1.5794058 9.612309
17903 38   .09454174 9.499519
17903 22    -.938623 8.976858
17903 29   .06557742 7.561481
17903 42  -3.4579985 7.994629
17903 20  -1.5095404 7.464418
17903 31     .309996 7.653685
17903  3  -1.2410915 7.984879
17903 30   -1.409982 8.955536
17903 21   -.6369653 9.230576
17903 11     .298394 8.123054
17903 50  -1.1569048 6.813181
17904 23    .6752646 8.895966
17904 18    .3472973 9.007171
17904 27   -.9267205 9.612309
17904 38    .6127225 9.499519
17904 22  -.05936692 8.976858
17904 29   1.0639912 7.561481
17904 42    2.920438 7.994629
17904 20   1.7501532 7.464418
17904 31   .23332956 7.653685
17904  3   1.9991994 7.984879
17904 30   2.0770676 8.955536
17904 21  -.13808934 9.230576
17904 11   1.6869762 8.123054
17904 50 -.014082765 6.813181
17906 23  -1.7272818 8.895966
17906 18  -1.3212264 9.007171
17906 27   1.3889062 9.612309
17906 38   -2.499419 9.499519
17906 22  .016165635 8.976858
17906 29  -.13765895 7.561481
17906 42    .5240142 7.994629
17906 20   .14931183 7.464418
17906 31  -1.5231147 7.653685
17906  3  -1.0374542 7.984879
17906 30   -.6860809 8.955536
17906 21   1.2918003 9.230576
17906 11   -.4755956 8.123054
17906 50    2.126551 6.813181
17909 23   1.8414198 8.895966
17909 18    .4079049 9.007171
17909 27     .853009 9.612309
17909 38    2.283632 9.499519
17909 22    .4488799 8.976858
17909 29   .53083247 7.561481
17909 42    .4235862 7.994629
17909 20    .7208984 7.464418
17909 31   -.6388606 7.653685
17909  3   .52334714 7.984879
17909 30    .2615478 8.955536
17909 21  -1.2171178 9.230576
17909 11    1.266272 8.123054
17909 50   -.7051903 6.813181
17910 23   -.3828725 8.895966
17910 18  -.10198422 9.007171
17910 27    -.933695 9.612309
17910 38   -1.445989 9.499519
17910 22    .4924625 8.976858
17910 29  -1.3868475 7.561481
17910 42  -2.8198106 7.994629
17910 20  -.27892438 7.464418
17910 31    .9887665 7.653685
17910  3   -.7084044 7.984879
17910 30   -.8223028 8.955536
17910 21    .6856021 9.230576
17910 11  -.17646083 8.123054
17910 50    .3103369 6.813181
17911 23    .5505428 8.895966
17911 18  -2.3079457 9.007171
end
format %td date
The data shown above shows the stocks in the top quartile of my data. I want to compute the Daily weighted mean of the silq variable for all stocks in my data (I have a total of 50 stocks) by taking mcap as weight. For every given date, I wish to use the first 14 stocks in top quartile (i.e. excluding stock 50) to compute the weighted silq. However, a stock's weighted silq should be computed by excluding it, so while computing the weighted silq of a stock which is the top quartile, I need to exclude it and use the remaining 14 stocks in the top quartile portfolio. For example, while computing the weighted silq of stock 23, I'll have to exclude it and using the remaining 14 stocks on that date.

I am not sure how I can do the above in Stata.

Please help me. Thanks in advance.