Hi,
I have an output (FigA) but want it to look like (FigB) - any ideas?
(FigA)
Yr | Mth | Product | Total |
2010 | 1 | D | 8445 |
2010 | 1 | R | 217 |
2010 | 1 | E | 7276 |
2010 | 2 | D | 322 |
2010 | 2 | R | 6845 |
2010 | 2 | E | 6508 |
2010 | 3 | D | 474 |
2010 | 3 | R | 7503 |
2010 | 3 | E | 6960 |
2011 | 1 | D | 6508 |
2011 | 1 | R | 6558 |
2011 | 1 | E | 6608 |
2011 | 2 | D | 6658 |
2011 | 2 | R | 6708 |
2011 | 2 | E | 200 |
2011 | 3 | D | 250 |
2011 | 3 | R | 900 |
2011 | 3 | E | 950 |
(FigB)
Yr | Product | Total |
2010 | D | 9241 |
R | 14565 | |
E | 20744 | |
2011 | D | 13416 |
R | 14166 | |
E | 7758 |
Proc REPORT, TABULATE OR FREQ.
I'd probably start with TABULATE.
Tabulate works but I need it to be in an output file not a table. When I use OUT= it doesn't keep the format of the proc tabulate and instead refers back to original file.
Given your sample they should be the same structure.
You can try PROC MEANS or FREQ.
i recommend against including missing values in first column.
If you want this in a data set what is the purpose of the blank values for year?
What will you do with the resulting data set?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.