* Set up data for example; proc sort data=sashelp.class out=ByAge; by Age; run; proc transpose data=ByAge out=HeightsByAge(drop=_name_) prefix=Height; by Age; var Height; run; proc print data=HeightsByAge; id Age; title1 "HeightsByAge data set"; run; data SecondSMALLEST; set HeightsByAge; SecondShortest=smallest(2,of height:); run; proc print data=SecondSMALLEST; id Age; title1 "Second Shortest found through SMALLEST function"; run;