BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I am using user defined format in proc report.

I want to see in summary report also categories from proc format that have no data.

So in this example I want that the summary report will include also information about 'China'.

What is the way to do it with proc report?

 

proc format;
value $ffmt
Europe,USA='Europe_USA'
Asia='Asia_without_China'
China='China'
;
Run;

PROC REPORT DATA=sashelp.CARS NOWD OUT=MyFirstReport;
COLUMNS Type Origin INVOICE=Max_INVOICE INVOICE=Mean_Invoice 
INVOICE=Count_Invoice TEST DriveTrain;
DEFINE Type / Group 'Type of Car' CENTER;
DEFINE Origin / Group 'Origin of Car' CENTER format=$ffmt.;
DEFINE Max_Invoice / ANALYSIS MAX 'Max of Invoice';
DEFINE Mean_Invoice / ANALYSIS MEAN 'Mean of Invoice';
DEFINE Count_Invoice / ANALYSIS N FORMAT=5.0 'Total Number of Cars' center;
DEFINE DriveTrain / ACROSS 'Type of DriveTrain of Car';
DEFINE TEST / COMPUTED 'Number of Cars > Mean(Invoice)' center;
COMPUTE TEST;
     TEST=N(_c7_>Mean_Invoice);
ENDCOMP;
RUN;
2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Use Completerows Option in the PROC REPORT Statement and Preloadfmt in the appropriate Define Statement like this

 

PROC REPORT DATA=sashelp.CARS NOWD OUT=MyFirstReport completerows;
COLUMNS Type Origin INVOICE=Max_INVOICE INVOICE=Mean_Invoice 
INVOICE=Count_Invoice TEST DriveTrain;
DEFINE Type / Group 'Type of Car' CENTER;
DEFINE Origin / Group 'Origin of Car' CENTER format=$ffmt. preloadfmt;
DEFINE Max_Invoice / ANALYSIS MAX 'Max of Invoice';
DEFINE Mean_Invoice / ANALYSIS MEAN 'Mean of Invoice';
DEFINE Count_Invoice / ANALYSIS N FORMAT=5.0 'Total Number of Cars' center;
DEFINE DriveTrain / ACROSS 'Type of DriveTrain of Car';
DEFINE TEST / COMPUTED 'Number of Cars > Mean(Invoice)' center;
COMPUTE TEST;
     TEST=N(_c7_>Mean_Invoice);
ENDCOMP;
RUN;
PeterClemmensen
Tourmaline | Level 20

@Ronein Did this work for you? 🙂

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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