Hi,

I'm trying to create portfolio weights per lender for certain SIC-codes. To obtain this, I have to modify my dataset to have only distinct months per lender.
So e.g. for MB Financial (see below) if all dates are available I want 2000m1, 2000m2....2018m11, 2018m12. The rest is not needed, since they are duplicates.

The variables used for this are the Lender, the Mdate = monthly date and Money_sum = loan amount of previous 12 months for this lender.
In short: I want to generate for every lender a maximum of (12months*18years) 216 observations. If there are no observations, there was no loan, so not needed.

Is there a way to code this is Stata?

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float Mdate str60 NewLender double Money_sum
668 "MB Financial"                    481496608
682 "Jefferies & Co"                13966407979
542 "JP Morgan"                 147217736836.25
641 "Regions Bank"                10018417621.5
669 "Wells Fargo"              135623811034.375
615 "Regions Bank"                 7529322231.5
699 "Antares Holdings"           10100840695.25
519 "Credit Lyonnais New York"       1610489864
665 "Regions Bank"               13972060499.75
553 "Harris Nesbitt"                 7892704250
end
format %tm Mdate
Thank you.