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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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