BookmarkSubscribeRSS Feed
BigD
Calcite | Level 5
Hi,

I have a strange behavior in proc report when using formatted across columns.

When I run proc report without the missing statement (as below), I get the correct output in that my hospitals are listed in the proper order, and then the group 'Other' catches the remaining hospitals (see below). When I use the missing statement, the 'Other' group comes first, and I would like it to come last in the list.

proc format ;
value $across_inpatient (notsorted)
'1'='H1'
'2'='H2'
'3'='H3'
'4'='H4'
Other = 'Other';
;run;

ods html;
proc report data= inpatient_join3 nowd ;

column closest_hospital tx_hospital real_separations , sum ;

define tx_hospital/ group across "Treatment Site" order=internal Center format= $across_inpatient. ;
define closest_hospital/ group order=internal format=bri_inpatient. "Closest Hospital" left;
define real_separations/ analysis sum format=comma12.0 '' center;
define sum / "Total" center format=comma12.0 center;

rbreak after / summarize ;
run;
ods html close;

Without Missing:
Closest Hospital H1 H2 H3 H4 Other

With Missing :
Closest Hospital Other H1 H2 H3 H4

How can this be fixed.

Thanks,
2 REPLIES 2
Tim_SAS
Barite | Level 11
Try ORDER=FORMATTED on the DEFINE TX_HOSPITAL statement. Edited by Tim@SAS


Message was edited by: Tim@SAS
BigD
Calcite | Level 5
The order =formatted changes the order to alphabetical order, also not desired.

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