Hi:
PROC FREQ is, essentially, creating a summary report -- given your code. There are no "observations" coming out of PROC FREQ -- FREQ is producing a report that can have titles and footnotes -- but essentially, just a REPORT.
If you wanted to create an output dataset, using PROC FREQ, then you would need to investigate how the OUT= option works or how the ODS OUTPUT destination works to create an OUTPUT dataset.
PROC FREQ does support WHERE statement processing. So these would all be valid PROC FREQs:
[pre]
proc freq data=sashelp.class;
where sex = 'F';
tables age;
run;
proc freq data=sashelp.shoes;
where sales gt 10000;
tables product;
run;
[/pre]
Also, I'm not sure I understand what you want. If you had this data (sorted in descending order) what would you envision:
[pre]
id num
a1 1000
b2 999
c3 998
d4 997
e5 996
f6 995
g7 994
h8 993
i9 992
j10 991
k11 990
l12 989
m13 988
n14 987
a1 14
b2 13
c3 12
d4 11
e5 10
f6 9
g7 8
h8 7
i9 6
j10 5
k11 4
l12 3
m13 2
n14 1
[/pre]
Possible outputs:
1) only the first 12 with the highest values for num. In this scenario, you would pick off the first 12 observations from the detail data and either create a report or an output dataset;
2) add up all the values for num by id and THEN pick off the highest 12 -- for example, in this scenario, ID of A1 would have a value of 1014 for NUM (the sum of the 2 observations for ID=AI) -- this could be either a report or an output dataset
3) summarize all the values, find the IDs of the 12 highest and then go back and get ALL the observations for these highest IDs. In this scenario, you would have 2 observations for A1 on a report or in an output dataset: [pre]
id num
a1 1000
a1 14
. . .
[/pre]
Depending on the result you want, PROC FREQ may not be the path to follow.
cynthia