BookmarkSubscribeRSS Feed
frisco
Calcite | Level 5
Hi, I have a reporting requirement to print BOTH the formatted and unformatted values side by side in a report.

For example:

Gender FEMALE 2

Is there a straightforward way to accomplish this? TIA.
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The answer will depend on how you expect to generate the report, that being with PROC PRINT, PROC REPORT, PROC SQL (or another procedure) or a DATA step?

Scott Barry
SBBWorks, Inc.
frisco
Calcite | Level 5
Most likely REPORT or PRINT.
Cynthia_sas
Diamond | Level 26
Hi:
PROC REPORT would probably be your best bet. You can use a variable to create a second report item with an "alias" for referencing on the report:
[pre]
column name gender gender=ugend age;
[/pre]

and then in your DEFINE statements, you can have:
[pre]
define gender / display f=gfmt. 'Formatted value';
define ugend / display 'Unformatted';
[/pre]

This is a neat feature of PROC REPORT because the format is applied on the DEFINE statement instead of in a FORMAT statement. In this example, the variable GENDER is used once on the report with a format and then the alias, UGEND, is GENDER used a second time on the report, but WITHOUT a format.

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
  • 3 replies
  • 1279 views
  • 0 likes
  • 3 in conversation