i have been working on SAS since a while. i have created a dummy dataset as follows:
data try1;
infile datalines;
length Level $ 10;
input Variable $ Level $ Exposure;
datalines;
A A1 100
A A2 200
A A3 300
A Unknown 1000
B B1 70
B B2 20
B B3 30
B B4 40
B Unknown 100
C C1 200
C C2 100
C C3 80
C Unknown 50
;
Run;
After successful completion of creating a dataset now i tried to find out the largest number in each class of 'Variables' and this has been done by the PROC MEANS procedure. the code for the same is as follows:
proc means data=try1 noprint;
Class Variable;
id Level;
var Exposure;
output out = try2 (drop = Level _TYPE_ _FREQ_)
maxid(Exposure(Level)) = max_factor
max=;
run;
I was able to get the correct output by the same. But now i want to know the second largest number in each class of 'Variables' and certainly i need an OUTPUT like this:
Max_Exposure Sec_Max_Exposure Output
Unknown A3 A3
Unknown B1 B1
C1 C2 C1
basically i need to eliminate the Unknown 'Level' so that i can get a desired output column.
Can anyone help me out with the problem using PROC MEANS statement.
Regards