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
SAS Super FREQ
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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1236 views
  • 0 likes
  • 2 in conversation