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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 974 views
  • 1 like
  • 2 in conversation