The idea of having variables names Alabama, Arkansas and Indiana seems opposite of the way SAS was designed to be most efficient. There's a reason why people say Long beats Wide, and normally it is because there is much less programming needed if your data is arrange properly, and probably the code will execute faster. In addition, people say data belongs in SAS variable values, not in variable names.
So here's a long data set with the same data, and with the state names as data instead of variable names. Note that you do not have to type in the variable names Alabama, Arkansas and Indiana into your code, and if there are other states in your data, the exact same code works.
data have;
input id value state $;
cards;
1 100 AL
1 200 AR
1 250 IN
2 200 AL
2 100 AR
2 275 IN
3 300 AL
3 900 AR
3 100 IN
4 250 AL
4 25 AR
4 120 IN
5 50 AL
5 8 AR
5 65 IN
6 400 AL
6 700 AR
6 200 IN
;
proc summary data=have nway;
class id;
var value;
output out=min min=minvalue minid(value(state))=min_state;
run;
Of course, in this very simple example, maybe the benefit isn't obvious, but in real world problems, long does beat wide, it works better in SAS because most SAS PROCs are designed to work on long data sets, and it will be less programming.
... View more