BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Meteorite | Level 14

 

 Data tbl;
 input branch sales;
 cards;
 1  10
 2  20
 3  30
 4  40
 ;
 run;


 proc format;
value FFMT 
1='North'
2='South'
3='East'
4='West';
Run;


Data tbl2;
set tbl;
FORMAT branch FFMT.;
Run;


proc report data=tbl2  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch sales;
define branch/ display 
	"Branch"  center;
define sales/  order order=internal descending
	"SALES 2018";
Run;

Hello

 

I want  that in the proc report field branch will appear 2 times: In one column as a formatted value (south,north,east,west)

In second column as a non formatted value( 1,2,3,4)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelLarsen
SAS Employee

Try this:

 

proc report data=tbl2  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch branch=branch2 sales;
define branch/ display 
	"Branch"  center;
define branch2/ display 
	"Branch unformatted" format=best. center;
define sales/  order order=internal descending
	"SALES 2018";
Run;

Regards,

Michael

View solution in original post

2 REPLIES 2
MichaelLarsen
SAS Employee

Try this:

 

proc report data=tbl2  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch branch=branch2 sales;
define branch/ display 
	"Branch"  center;
define branch2/ display 
	"Branch unformatted" format=best. center;
define sales/  order order=internal descending
	"SALES 2018";
Run;

Regards,

Michael

gamotte
Rhodochrosite | Level 12

Hello,

 

Data tbl;
 input branch sales;
 cards;
 1  10
 2  20
 3  30
 4  40
 ;
 run;


 proc format;
value FFMT 
1='North'
2='South'
3='East'
4='West';
Run;

proc report data=tbl  headline split='#' spacing=1 nowd
style(report)={cellpadding=1 cellspacing=1}
style(header)={font_size=2  font_weight=MEDIUM  font_face=david  background=cx99ccaa}
style(column)={font_size=1}; 
columns  branch branch2 sales;
define branch/ display 
	"Branch"  center;
define branch2 / computed format=FFMT.;
define sales/  order order=internal descending
	"SALES 2018";
compute branch2;
	branch2=branch;
endcomp;
Run;

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
  • 2 replies
  • 596 views
  • 1 like
  • 3 in conversation