BookmarkSubscribeRSS Feed
Allaluiah
Quartz | Level 8

summarized report and graph help

I have a SAS dataset that has following the variables like following example:

Cust_ID               State     City                         Income             Profit           age

1                         TX         Houston                   15000             400               24

5                         OR       Portland                   20000             300             40

7                         TX         Houston                   7500                 100             23

8                         VA       Arlington                     4000               340             38

9                         OR       Portland                   17000             120               19

15                       CA         Sacremento             9000                 300             45

3                         CA       San francisco           14000             240               56

 

The actual dataset is 20 million records with unique cust_ids, however i want a summarization done at state level, age level, city level and represent the report in the form of a bar chart or the best possible graph to make sense and make reading easy.

 

Q1. For state, i want the the top 10 states contributing to the maximum profit starting left most to right most.

 

Q2. For city,, I want the top 10 cities contributing to the maximum profit same as above (BUT "NOT" CITY GROUPED AMONG STATES, THAT IS CITY IS CONSIDERED A DIFFERENT ENITITY AND NOT WITHIN STATE)

 

Q3. For age, i want to group 0-20, 20-30,30-40,40-50 age ranges and create a bar charts to visualise the age ranges that are top contributors to the profit.

 

Can anyone help me with the use of SAS summrization and graph example please? In excel i know well, but SAS i need help please

1 REPLY 1
ballardw
Super User

Since this look a lot like homework here's some hints. Post back with your attempts it you don't get solutions that work.

 

Q1 Summarize the data using state as a grouping variable to create an output data set with the desired totals. The sort descending by the total variable. In your graphing procedure you can indicate the sorted data set and use the data set option OBS=10 to get the first 10 records into the plot.

 

Q2.Summarize as above with city as the grouping variable.

 

Q3. Create a custom format that assigns age group values to the desired range and associate that format with the age variable in the graphing procedure.

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 681 views
  • 0 likes
  • 2 in conversation