Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65651

How to delete all observations except the last one in each month?

$
0
0
Hello,

I am new in Stata. I would appreciate your help.
I want to delete all observations except the last one in each month. So, I want the last observation of jan/1927, the last observation of feb/1927 and so on.


Example:
permno date retl retw id newid retwl
11789 31/jan/27 -.4911771 .4012769 9 1 .892454
10073 31/jan/27 -.3965825 .4692593 10 1 .8658419
10647 31/jan/27 -.5990365 .6592593 11 1 1.258296
11519 31/jan/27 -.6194447 .5867956 12 1 1.20624
14330 31/jan/27 -.6279929 .4129298 16 1 1.040923
12802 28feb1927 -.2189815 4.511984 60 2 4.730966
12722 28feb1927 -.4094577 4.613336 61 2 5.022793
10639 28feb1927 -.4542338 4.86881 62 2 5.323044
12984 28feb1927 -.4171968 5.503687 63 2 5.920884
15245 28feb1927 -.3505301 5.536296 64 2 5.886826
10524 28feb1927 -.3341367 5.697093 65 2 6.031229
15413 28feb1927 .2658634 5.809214 66 2 5.54335
13581 28feb1927 .5158634 5.804429 67 2 5.288566
10209 28feb1927 .5207414 5.806482 68 2 5.285741
12263 28feb1927 .8022228 5.867244 69 2 5.065022
10647 31/mar/27 -.4090909 .0978261 70 3 .506917
12984 31/mar/27 -.5400433 .1848749 71 3 .7249182
10399 31/mar/27 -.7493456 .0289498 72 3 .7782953
12722 31/mar/27 -.6905221 .0153443 73 3 .7058664
15413 31/mar/27 -1.065522 .0075924 74 3 1.073114
11690 31/mar/27 -1.080015 .0763285 75 3 1.156343
12634 31/mar/27 -1.100848 .297037 76 3 1.397885

Anyone know how to do it?

Thank you

Viewing all articles
Browse latest Browse all 65651

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>