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-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
  • 7 replies
  • 952 views
  • 1 like
  • 3 in conversation