DATA Step, Macro, Functions and more

Proc Report -Want to see a field two times-with format and without

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 142
Accepted Solution

Proc Report -Want to see a field two times-with format and without

[ Edited ]

 

 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)

 

 


Accepted Solutions
Solution
a week ago
SAS Employee
Posts: 25

Re: Proc Report -Want to see a field two times-with format and without

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


All Replies
Solution
a week ago
SAS Employee
Posts: 25

Re: Proc Report -Want to see a field two times-with format and without

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

Super Contributor
Posts: 340

Re: Proc Report -Want to see a field two times-with format and without

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;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 54 views
  • 1 like
  • 3 in conversation