BookmarkSubscribeRSS Feed
Hank
Fluorite | Level 6

Hi,

The code below creates a table of the number of observation with the value "infinity" in the variable "tim_diff", for each variable observation "etikett".

I have made it so that the table is sorted in order of frequencies (order=freq).

My problem is that I want to choose just the 50 highest observations. I.e. the 50 observations in "etikett" with the highest number of frequencies in "tim_diff".

I have tried "(obs=50), but then it just chooses the first 50 observations, not the ones with the highest frequencies. Does anyone have a suggested solution to the problem? 

proc freq data=Timlon order=freq nlevels;

table etikett*tim_diff / nopercent norow nocol list missing;

where tim_diff=.I;

run;

Thanks in advance!

Best regards,

Hank

1 REPLY 1
data_null__
Jade | Level 19

This usually requires 2 steps one to summarize and another to select the top freqs.

proc summary data=sashelp.class nway;
  
class age / descending order=freq;
   output out=count;
   run;
proc print data=count(obs=3);
   run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 7746 views
  • 3 likes
  • 2 in conversation