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

I'm using the below code to create a report. The output looks great, but I need to apply formatting to my missing values, specifically for Paid and Percent. The non-zero data was formatted earlier during a SQL procedure. So far I've tried restating the format with DEFINE and also with FORMAT after define - neither worked.

 

Any ideas?

 

Thank you,

Ryan

 

ods escapechar="^";

options nodate label orientation=portrait nobyline missing=0;

ods _all_ close;

ods pdf file = "\\TEST.pdf"

style=htmlblue;

 

PROC REPORT DATA=WORK.STEP2;

COLUMN TT_Description NetworkType, (Claims Paid Percent);

define TT_Description / group "Treatment Type";

define NetworkType / " " across;

define Claims / analysis sum;

define Paid / analysis sum;

define Percent / analysis sum;

 

RUN;

 

ODS PDF CLOSE;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

SO before your PROC REPORT

 

proc format;
    value paidf .='$0.00' other=[dollar14.2];
run;

You can figure out what to do for percent, it's similar.

 

Then, in PROC REPORT

 

define paid / analysis sum format=paidf.;

 

 

--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

@rlafond wrote:

I'm using the below code to create a report. The output looks great, but I need to apply formatting to my missing values, specifically for Paid and Percent. The non-zero data was formatted earlier during a SQL procedure. So far I've tried restating the format with DEFINE and also with FORMAT after define - neither worked.

 


Format the missings to what?

 

In any event, you can define a format in PROC FORMAT that includes the desired formatting for missing values before your run PROC REPORT, and then apply the format in PROC REPORT.

--
Paige Miller
rlafond
Obsidian | Level 7

I want missing values for Paid to be dollar14.2 and Percent to be Percent5.1.

 

How would I write a PROC FORMAT to target missing values in PROC REPORT?

 

Thanks,

Ryan

 

ballardw
Super User

@rlafond wrote:

I want missing values for Paid to be dollar14.2 and Percent to be Percent5.1.

 

How would I write a PROC FORMAT to target missing values in PROC REPORT?

 

Thanks,

Ryan

 


And what exactly does a missing value in dollar14.2 look like? "$            .00"   "$**********.**" something else?

Same with what does a missing value in Percent5.1 look like?

BTW you may want to either consider using PercentN5.1 or make the width wider as Percent5.1 does not show 100 percent very well:

data example;
   input x;
datalines;
1
.1
.01
-.1
-.01
;
run;
proc print;
   format x percent5.1;
run;
PaigeMiller
Diamond | Level 26

@rlafond wrote:

I want missing values for Paid to be dollar14.2 and Percent to be Percent5.1.

 

How would I write a PROC FORMAT to target missing values in PROC REPORT?

 


No, you want the non-missing values for PAID to be dollar14.2 and the non-missing values for PERCENT to be percent5.1.

 

So we still don't know what you want the missing values to look like. Show us. Type it in what the missing values are supposed to look like.

--
Paige Miller
rlafond
Obsidian | Level 7

Missing values for Paid should look like $0.00 and missing values for Percent should look like 0.0%.

PaigeMiller
Diamond | Level 26

SO before your PROC REPORT

 

proc format;
    value paidf .='$0.00' other=[dollar14.2];
run;

You can figure out what to do for percent, it's similar.

 

Then, in PROC REPORT

 

define paid / analysis sum format=paidf.;

 

 

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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