BookmarkSubscribeRSS Feed
Cho8
Calcite | Level 5

I/P:

 

Y1Y2X1X2
20120120080123
20120120080215
20120120080200
201201200802411
20120120080258
20120120080289
20120220080213
20120220080300
20120320080345
20120320080300
20120420080430
20120420080400
20120520080400
20120520080443
20120520080400
20120520080400

 

 

O/P:

 

Y2/Y1201201201202201203201204201205Grand Total
2008012    2
200802181   19
200803 04  4
200804   347
Grand Total20143432

 

1.Y1 & Y2 in Row and Columns.

2.Sum(X1) in tabular format

 

3.Row totals and column totals

 

10 REPLIES 10
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Cho8
Calcite | Level 5

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...)

 

 

 

PaigeMiller
Diamond | Level 26

@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?

--
Paige Miller
Cho8
Calcite | Level 5

I did Excel Pivot to find sum of data for each transaction.

 

 

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Cho8
Calcite | Level 5

I did change the format of data,see if it answers u r Question

Kurt_Bremser
Super User

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.

PeterClemmensen
Tourmaline | Level 20

The same question as @PaigeMiller .. Also, di you need this in a SAS data set or a report?

Cho8
Calcite | Level 5

SASDataset

Shmuel
Garnet | Level 18

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;

 

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

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
  • 10 replies
  • 2105 views
  • 2 likes
  • 5 in conversation