BookmarkSubscribeRSS Feed
AmeeKang
Quartz | Level 8

 

This is a table A and B.

1.png

 

3.png

 

 

 

 

I want to create the following result by using SQL with the KEY value of the DTGBN column.

 

2.png

 

some body help me!!!!

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Please explain the logic used here to give the desired result to be 100+300+50+70-20

 

How do you get that from the original data, what is the logic?

 

What does table B have to do with this problem?

--
Paige Miller
mkeintz
PROC Star

How do you know that you are supposed to:

  1. Add the four RFAMT entries in blue cells (100+300+50+70)
  2. Subtract the RFAMT in yellow (-20)
  3. Ignore the RFAMT in the white cell (970000090)

 

Why do you refer to the DTBIN column as a key?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
andreas_lds
Jade | Level 19

Just guessing:

  • DTGBN: T = addition, M = substraction
  • table_b.accno must match either table_a.iacno or table_a.oacno

Right?

Drop the idea of using sql, data step is most likely better readable an far easier to code.

Until you post the data in usable form (data steps with datalines) i can't suggest any code.

andreas_lds
Jade | Level 19

Another thing you need to tell us: what exactly do you expect as output? A dataset, a table, a line in the log? How should it look like?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 662 views
  • 1 like
  • 4 in conversation