This is my first time on this forum and untill now I have found a lot of answers for my question on here.
However, this time I'm struggling with a question where I can't find the answer for on this forum.
I am using panel data with different companies in different countries and years. I want to make a dummy variable called Dominant, where a firm is dominant if it has the highest net sales out of its industry in its country by year. So per year and industry one firm should be assigned an 1. I did this by using the following commands:
Code:
egen Max_Sales = max( Net_Sales ), by( cntrycde SICCODE year) gen Dominant=1 if Net_Sales== Max_Sales replace Dominant=0 if Dominant==.
The selected part is year 2010 for South Korean firms with the same industry code. The biggest value of net sales (8.32e+09) is the same for the max_sales variable I created, but still the Dominant value in row 21151 doesn't get a 1.
I tried to fix this by changing the format and therefore using the following commands:
Code:
format %15.0g Net_Sales egen Max_Sales = max( Net_Sales ), by( cntrycde SICCODE year) format %15.0g Max_Sales gen Dominant=1 if Net_Sales== Max_Sales replace Dominant=0 if Dominant==.
I hope that my problem is clear, I need the Max_Sales value in row 21152 to be exactly the same as the Net_sales variable but I can't figure out how to get this.
Any ideas would be highly appreciated.
Thank you in advance,
Lotte
0 Response to Max value changes because of different format
Post a Comment