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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 835 views
  • 0 likes
  • 2 in conversation