I know in Bysort you have to generate something. But other than that will using Sort X Y vs. Bysort X Y make any changes to the structure of my data?
For example, if I wanted to arrange my dataset in the following way:
1. First by CompanyID in an ascending order.
2. Within the company ID, I want the data to be arranged by Year next.
From what I understand "Sort CompID Year" will arrange my dataset in that order. Will "Bysort CompID Year: gen A=1" do the same under all circumstances?
For example, if I wanted to arrange my dataset in the following way:
1. First by CompanyID in an ascending order.
2. Within the company ID, I want the data to be arranged by Year next.
From what I understand "Sort CompID Year" will arrange my dataset in that order. Will "Bysort CompID Year: gen A=1" do the same under all circumstances?
Comment