BookmarkSubscribeRSS Feed
Sir_Highbury
Quartz | Level 8

Dear experts,

 

I have data set (sheet input in the attachment) and on the base of two variables, seller id and revenues, I wouldlike to group the data showing:

- top 5 sellers;

- residual part;

- absolute and percentage values;

(sheet output in the attachment).

I just used the proc sql to sort and then I selected the top 5 using the outobs in the proc sql but to get the full picure I want is taking too many steps. Any elegant and wuick solution to propose?

Thanks in advance.

 

BRs,

SH

 

3 REPLIES 3
LinusH
Tourmaline | Level 20
How many is too many?
PROC RANK is an alternative to pick a top.
For the percentage (and the overall report) I would investigate if PROC TABULATE could fit your needs.

PS
Please don't attach Excel files.
Data never sleeps
ballardw
Super User

This link https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... has instructions on how to turn a SAS dataset into a datastep. Then you can post text of the actual data (or your example data at least) in form that we can use to test code.

 

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

Sir_Highbury
Quartz | Level 8

Thanks for you advises, I cheked the proc rank but in the end I got what I needed using the dear old proc sql and a proc tabulate to finalize it.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 743 views
  • 0 likes
  • 3 in conversation