if you use proc summary with class-clause, it will sort your observations in order of this class-clause.
proc summary data=One;
by var_1;
class var_2 var_3 var_4;
output out = Two(drop= _freq_ _type_);
run;
1) am i right?
2) what happens, if i don’t specify all fields?
proc summary data = Three(keep= var_1 var_2 var_ 3 var_4 var_5 var_6);
by var_1;
class var_2 var_3;
output out = Four(drop= _freq_ _type_ );
run;
3) which proc faster: proc summary or proc sort?
A few things to note here.
Hope this helps.
Here is an example of my last point. Using
_all_asks to return all variables in the dataset, this does create a warning in the log for the variables previously listed in the CLASS statement, but it can be safely ignored. It’s basically me being lazy in not wanting to specify the remaining variables separately for wide datasets.