BookmarkSubscribeRSS Feed
Obsidian | Level 7

I've been dipping my toes into the PROC REPORT world after having relied on PROC TABULATE to output some large demographic tables, especially with the additional customization that PROC REPORT offers. I have a dataset of around 6 thousand patients, and int his dataset is some common demographic characteristics: age group (3 categories), race_cat (4 categories), gender (binary), bmi_cat (4 categories), and a slew of comorbidity indicators (all binary), e.g., cancer, diabetes, chf, etc. Also within this dataset are some continuous measures that I output statistics for - age, length of stay, Charlson comorbidity score. And I'm outputting all of these by a binary indicator - tested (0,1). This will also contain a column that sums up the total going across. See attachment for sample dataset and PROC TABULATE code.


However, I've a lot of difficulty transitioning this to PROC REPORT, especially with multiple measures that (I believe) need to be defined as a group and where tested will be defined as the across measure. Any advice?

Super User

You should show what you expect the output of the procedure to look like. Best would be to provide a small enough sample data set that you can manually make your report and then show us the values.


Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.


Instructions here: will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.


The procedures Tabulate and Report do things differently and if you want multiple variables in a single column from Proc Report then you will likely need to do some reshaping of your data because that is not natural behavior for Proc Report.

Barite | Level 11

Ì did not open your xlsx file however, I would suggest reading up on papers on this topic such as:


Furthermore, once you master proc report you will find its deficiencies and then it will be time to pick up RWI (report writing interface).  It complements Proc report and tabulate rather than replace them



  I did not open your Excel file -- it's more useful to have a DATA step program that creates your data, so I do not have to write a program to read the data.


  However, do any of your demographic reports look like Examples for #1 (page 9) , or Example #8 (page 17) in this paper: ?? If so, I had to restructure the data and add some "helper" variables to produce the final output from PROC REPORT for #1 and DATA _NULL_ for #8.


  For challenges with ACROSS, this paper is useful: and for working with COMPUTE blocks, this paper has some good tips: .


  After the spare elegance of TABULATE syntax, PROC REPORT can seem wordy and overly complicated to some folks. But the ability to customize the breaks, add lines and compute new columns directly in the REPORT syntax are things that you can't do with TABULATE. I don't know whether you need any of those things, since I can't visualize your data from your description or what it is your desired report needs to look like.


  Hope the papers point you to more info about PROC REPORT.






Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 4 in conversation