BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HarshaChaube
Fluorite | Level 6

Hi,

 

I'm stuck with the coding part for this particular dataset.

Kindly help.

 

---------------------------------------------------------------------------------------------------------------------------------------

 

We have a branch sales data in below table, read this dataset and then categorize and find count of branches on basis of sales.

 

Sales can be categorized as

 

Category

Sales description

Low

Sales < 2,00,000

Medium

2,00,000 < sales < 3,00,000

High

3,00,000 < sales < 4,00,000

Exceptional

Sales > 4,00,000

 

                                                                                          

Branch

sales

1

2,80,000

2

1,50,000

3

4,50,000

4

3,20,000

5

2,22,000

6

1,75,000

7

5,00,343

8

2,63,000

9

1,15,000

10

2,55,000

 

 

Thanks in advance. 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
data have;
input Branch sales;
datalines;
1 280000
2 150000
3 450000
4 320000
5 222000
6 175000
7 500343
8 263000
9 115000
10 255000
;

proc sql;
   create table want as
   select case when sales < 200000 then 'Low'
               when 200000 <= sales < 300000 then 'Medium'
               when 300000 <= sales < 400000 then 'High'
               else 'Exceptional'
         end as Category
         ,count(calculated Category) as Count
   from have
   group by calculated Category;
quit;

View solution in original post

7 REPLIES 7
PeterClemmensen
Tourmaline | Level 20

what numerical value does 2,80,000 represent? 

 

Don't quite get the punctuation 🙂

HarshaChaube
Fluorite | Level 6

Hi,

 

The sales price is in INR (Rs).

 

 

Thanks !

HarshaChaube
Fluorite | Level 6

what if there's no comma ? 

 

Consider the sales price as - Rs. 228000.

Same for all the rest.

 

 

Thanks !

PeterClemmensen
Tourmaline | Level 20
data have;
input Branch sales;
datalines;
1 280000
2 150000
3 450000
4 320000
5 222000
6 175000
7 500343
8 263000
9 115000
10 255000
;

proc sql;
   create table want as
   select case when sales < 200000 then 'Low'
               when 200000 <= sales < 300000 then 'Medium'
               when 300000 <= sales < 400000 then 'High'
               else 'Exceptional'
         end as Category
         ,count(calculated Category) as Count
   from have
   group by calculated Category;
quit;
HarshaChaube
Fluorite | Level 6

I'm new to this and have never used ",count".

 

,count(calculated Category) as Count

 Thank you. 🙂

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2061 views
  • 1 like
  • 3 in conversation