BookmarkSubscribeRSS Feed
Konkordanz
Pyrite | Level 9

Hi,

my question is hard to descibe. But ill try it:

With a proc-tabulate-step its possible, to use a variable twice: First, I sum the three values of LFBP_erwtyp3 (black frame, 01_ET, 02_EL, 03_NEP). Afterwards I sum the same variable, but differentiated by the Variable LF_Typ28 and its values (red frame).

 

Konkordanz_2-1664202467626.png

 

 

My Question: I tried to create this table structure also within a proc-report step (cause i want to learn it). But: Im not able to get both results in one table. For example, with following code...

 

 

proc report data=test16;
column LF_Typ28 LFBP_erwtyp3 HRF_P_Sn;
define LFBP_erwtyp3 / group;
define LF_Typ28 / group;
define HRF_P_Sn / analysis;
run;

...i get the content of the red frame. But how can I add the content of the black frame? Or is this only doable with proc tabulate?

Thank you!

 

 

 

 

2 REPLIES 2
Cynthia_sas
Diamond | Level 26
Hi:
PROC REPORT and PROC TABULATE will generate a lot of reports exactly the same. However, one thing that PROC REPORT has that TABULATE does NOT is the ability to produce customized break lines and add text at the break. One of the things that TABULATE can do that REPORT does NOT do is stack variables in the row dimension of the output table as you show. PROC REPORT would do that in 2 separate report. Essentially TABULATE is generating 2 different tables, the table outlined in black, that you've called out and the table underneath it. These 2 tables are stacked on top of each other in the row dimension using the same variable in the column dimension. PROC REPORT doesn't build tables that way.
PROC REPORT builds the report table using the variables in the COLUMN statement and once you define the variables to go across the report row from left to right, you will not be able to change the usage or the nesting of the variables on the report. Nor will you be able to generate 2 separate report tables and stack them. When you need to essentially "stack" tables, such as for a demographic report, you generally need to pre-process the and pre-summarize the data so it is in the structure you want before you create the report output with PROC REPORT.
Cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 784 views
  • 1 like
  • 2 in conversation