Some questions:
Do you want total-period medians over all 6 years, or do you want yearly "complimentary" medians? By "complimentary" I mean excluding the company in hand.
Could you show, in a data step, a sample of what your incoming data looks like?
Are your data sorted by SIC (probably not, but it's worth knowing).
The crude way of doing this is to output each company's data N(sic)-1 times, where N(sic) is the number of industries in a given SIC. And output it in such a way that there are N(sic) group id's (variable GROUPID), such that company i is not in groupid=I. Then tell SAS to run a proc to generate medians for each sic/year/groupid. Finally match those median to the company data.
How big is your dataset, i.e. how many total company/years do you have?
Edited addition: And how many SIC's do you have? Then we would know the average size of each SIC, and the number of times a median must be calculated.
... View more