I would like to order the variables (corresponding to the Stata command "order") from left to right based on the latest observation (here, the only observation of each variable that matters is the one corresponding to w_date=2022w46"). Here is the dataset:
Code:
clear all
input str7 w_date cpd cpdpf cpdpm
"2022w44" -.3522595 -.15837106 .45831277
"2022w45" -.05552628 .00728419 .63357966
"2022w46" -.04414876 .08082671 .65427268
end

In other words, I would like to automate the fact that I would like to order the variables as follow:
Code:
order w_date cpdpm cpdpf cpd
To give a bit of context, I have 100+ variables that are cumulative returns. What matters in my context is the highest generated return at the latest date of the sample, in this example 2022w46. I would like to see the one that generate the highest returns from left to right on the screen to select the later

Can you help me automate that?