BookmarkSubscribeRSS Feed
Wendi
Calcite | Level 5
I recently ran into a request (that I have seen before) about putting two statistics into the same cell. Apparently, APA Style requires this type of report that has the N in the same cell as the percent (with the percent in parentheses).

Each cell would look like this: xx,xxx (xx%) using the comma format for the N and the percent format for the percent.

The way I would handle this in the past is create and save the statistics, then, in a data step, convert them to character fields, concatenate them together and then use proc report or proc print to print the report.

My question is, is there a way I can do this directly in any procedure? It would be nice to get this out of proc tabulate without doing the extra data step. Or is there any other more efficient way to do this that I haven't even thought of?
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
A lot of folks use PROC REPORT directly (with a COMPUTE block) to concatenate the 2 numeric vars into a character var; or they use a combination of DATA step to do the "data massaging" (such as indicating what lines to indent or which lines to bold) and then PROC REPORT to to the report. Some folks (who need more control) use DATA _NULL_ and a custom TABLE template.

If you look at this paper, you can see 3 different types of this report. Generically, I called them "demographic" reports, because this is what my students always called them. There are 2 versions of Example 1 (both use PROC REPORT) on massaged data and 1 version of Example 8 (which uses DATA _NULL_ and a custom TABLE template.)

The paper is here: http://www2.sas.com/proceedings/forum2008/173-2008.pdf
The data and programs are here: http://support.sas.com/rnd/papers/sgf2008/complex_reports.zip

Examine the data for example 1 -- the 2 files have already been "massaged" and the 2 PROC REPORTs for example 1 are expecting data in this structure.

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
  • 1 reply
  • 1701 views
  • 0 likes
  • 2 in conversation