BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
walterwang
Obsidian | Level 7
numberyear1year2year3year4
Males6,6217,0767,1947,135
Females5,0475,5305,4265,495
Persons(d)11,66812,60612,62012,630
Rate    
Males2.32.42.22.4
Females2.02.02.22.3
Persons(d)2.12.22.2

2.3

 

 

How should I format the output?

1 ACCEPTED SOLUTION

Accepted Solutions
walterwang
Obsidian | Level 7

proc report nowd data=sashelp.class;

col name sex age weight height;

compute height;

if sex='F' then do;

do i = 3 to 5;

call define(i,'format','dollar8.2');

end;

end;

endcomp;

run;

View solution in original post

2 REPLIES 2
Reeza
Super User

I *think* you can add a grouping variable and then conditionally format the lines using a COMPUTE statement. 

 


@walterwang wrote:
number year1 year2 year3 year4
Males 6,621 7,076 7,194 7,135
Females 5,047 5,530 5,426 5,495
Persons(d) 11,668 12,606 12,620 12,630
Rate        
Males 2.3 2.4 2.2 2.4
Females 2.0 2.0 2.2 2.3
Persons(d) 2.1 2.2 2.2

2.3

 

 

How should I format the output?


 

walterwang
Obsidian | Level 7

proc report nowd data=sashelp.class;

col name sex age weight height;

compute height;

if sex='F' then do;

do i = 3 to 5;

call define(i,'format','dollar8.2');

end;

end;

endcomp;

run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 2 replies
  • 1215 views
  • 2 likes
  • 2 in conversation