BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
LABRADOR
Obsidian | Level 7

How do I calculate gross sales from Order Quantity and Unit Price in SAS 9.4? 

Order Quantity Unit Price Gross Sales
20 $37.72  
11 $35.85  
1 $37.72  
28 $35.85  
8 $37.33  
20 $35.85  
15 $37.72  
1 $37.33  
16 $12.10  
19 $13.64  
30 $35.85  
13 $37.72  
5 $12.10  
26 $37.33  
9 $12.10  
8 $13.64  
23 $35.85  
17 $13.64  
11 $37.72  
26 $37.33  
3 $37.33  
6 $12.10  
7 $37.72  
28 $13.64  
19 $35.85  
26 $13.64  
11 $37.33  
24 $35.85  
27 $37.72  
21 $13.64  
16 $35.85  
15 $35.85  
4 $12.10  
29 $37.72  
3 $13.64  
14 $35.85  
12 $37.72  
10 $37.72  
6 $35.85  
8 $37.72  
20 $37.33  
22 $13.64  
25 $37.33  
2 $12.10  
26 $35.85  
30 $37.72  
20 $37.72  
28 $35.85  
25 $12.10  
17 $37.72  

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

First figure out what is the name of the dataset. Let's say it is named HAVE.

Second figure out what are the names of the variables. Let's say they are named QUANTITY and PRICE.

 

Now you have the information you need to write some code.

data want;
  set have;
  gross = quantity*price;
run;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

First figure out what is the name of the dataset. Let's say it is named HAVE.

Second figure out what are the names of the variables. Let's say they are named QUANTITY and PRICE.

 

Now you have the information you need to write some code.

data want;
  set have;
  gross = quantity*price;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 877 views
  • 1 like
  • 2 in conversation