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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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