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.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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