Hi all,
I have the following problem: I have a large dataset that contains many variables and I have to order all variables based on their mean. The variable with the largest mean should be at the beginning of the dataset. For example, assume I have the following data set:
Then, the code should order my variables as follows:
I was playing around with collapse/reshape, but did not come up with a solution. Is there an (efficient) way to achieve this task?
Would really appreciate your help.
Best,
Antoine
I have the following problem: I have a large dataset that contains many variables and I have to order all variables based on their mean. The variable with the largest mean should be at the beginning of the dataset. For example, assume I have the following data set:
Code:
Observation Var1 Var2 Var3 Var4 Var5 1 3 10 100 1 200 2 3 12 80 2 300 3 4 11 90 1 250 4 4 9 100 2 400
Code:
Observation Var5 Var3 Var2 Var1 Var4 1 200 100 10 3 1 2 300 80 12 3 2 3 250 90 11 4 1 4 400 100 9 4 2
Would really appreciate your help.
Best,
Antoine
Comment