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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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