I/P:
Y1 | Y2 | X1 | X2 |
201201 | 200801 | 2 | 3 |
201201 | 200802 | 1 | 5 |
201201 | 200802 | 0 | 0 |
201201 | 200802 | 4 | 11 |
201201 | 200802 | 5 | 8 |
201201 | 200802 | 8 | 9 |
201202 | 200802 | 1 | 3 |
201202 | 200803 | 0 | 0 |
201203 | 200803 | 4 | 5 |
201203 | 200803 | 0 | 0 |
201204 | 200804 | 3 | 0 |
201204 | 200804 | 0 | 0 |
201205 | 200804 | 0 | 0 |
201205 | 200804 | 4 | 3 |
201205 | 200804 | 0 | 0 |
201205 | 200804 | 0 | 0 |
O/P:
Y2/Y1 | 201201 | 201202 | 201203 | 201204 | 201205 | Grand Total |
200801 | 2 | 2 | ||||
200802 | 18 | 1 | 19 | |||
200803 | 0 | 4 | 4 | |||
200804 | 3 | 4 | 7 | |||
Grand Total | 20 | 1 | 4 | 3 | 4 | 32 |
1.Y1 & Y2 in Row and Columns.
2.Sum(X1) in tabular format
3.Row totals and column totals
Can you please explain this further? How are X1 and X2 used to compute the output? How do you get 4361 in the row 200801 and the column 201201? That's not a sum of anything I can figure out.
In other words, explain the steps that enable you to take the inputs and come up with the outputs.
That is transactional data..huge data.. I gave Sample data..
X1=SUM(Y1) Group By Y1.
X2=SUM(X2) Group by Y2.
201801 =Sum(201801+201801+20810...)
@Cho8 wrote:
That is transactional data..huge data.. I gave Sample data..
Yes, I understand this part.
X1=SUM(Y1) Group By Y1.
X2=SUM(X2) Group by Y2.
201801 =Sum(201801+201801+20810...)
This I don't understand at all. Again I ask, how do you compute 4361 in the row 200801 and the column 201201?
I did Excel Pivot to find sum of data for each transaction.
You need to show us how to take the inputs you in the sample you provided, and then obtain the outputs in the sample you provided. You can't give us answers based upon some other data that we don't have. You haven't answered the very specific questions that I asked, so at this time, I can't help you.
I did change the format of data,see if it answers u r Question
How do you compute the number 4361?
Answer that question in detail instead of feeding us terse, meaningless and useless one-liners.
Show exactly which numbers of the source data contribute to this result, and which calculations are used.
The same question as @PaigeMiller .. Also, di you need this in a SAS data set or a report?
SASDataset
Try next code. If it does not fit what you want, please explain what's wrong:
data have;
infile cards dlm='09'x;
input Y1 Y2 X1 X2 ;
cards;
201201 200801 2 3
201201 200802 1 5
201201 200802 0 0
201201 200802 4 11
201201 200802 5 8
201201 200802 8 9
201202 200802 1 3
201202 200803 0 0
201203 200803 4 5
201203 200803 0 0
201204 200804 3 0
201204 200804 0 0
201205 200804 0 0
201205 200804 4 3
201205 200804 0 0
201205 200804 0 0
; run;
proc tabulate data=have ;
class y1 y2;
var x1;
table y2=' ' all='Grand Toatl',
y1=' '*x1=' '*sum=' '*f=4. all='Grand Total'
/box='Y2/Y1';
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.