DATA Step, Macro, Functions and more

PROC Report Displays * when provided with Proc Format value

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

PROC Report Displays * when provided with Proc Format value

My Requirement :

 

I want to display hyphen (-) in my excel report when the values are zero(0).

 

My Code:

 

PROC FORMAT;

value zero 0='-';
RUN;


PROC REPORT data=sasuser.test nofs headline headskip missing split='/'
style(summary)=[color=cx3e3d73 backgroundcolor=cxaeadd9
fontfamily=helvetica fontsize=3 textalign=r font_weight=bold] ;
WHERE desc_code='3';
column ID Count_Of_Scripts Count_Of_Members;
define ID / ORDER=data 'ID Code' format=$11. order=formatted;
define Count_Of_Scripts / analysis SUM CENTER 'Count Of Scripts' missing;
define Count_Of_Members / analysis SUM CENTER format=zero. 'Count Of Members' missing;
rbreak after / summarize;
COMPUTE AFTER;
BRND_NM='Total';
ENDCOMP;

 

 

Problem:

 

It works fine when the data is actually 0  in column Count_Of_Members. But, It displays * in some places (not all values ) even when Count_Of_Members has valid  numerical value 

 

any sugesstions on how to better deal about displaying a hyphen (-) when the column values are zero.

 

Thanks,

M


Accepted Solutions
Solution
‎08-15-2016 12:21 PM
SAS Super FREQ
Posts: 684

Re: PROC Report Displays * when provided with Proc Format value

hi

 

You should add a default length like so

 

proc format fmtlib;
  value zero (default=12)
    0='-'
  ;
run;

As the format iscurrently defined, the default length is 1, this is why you get the "*"

 

The FMTLIB option will print information on the format created.

 

Bruno

View solution in original post


All Replies
Solution
‎08-15-2016 12:21 PM
SAS Super FREQ
Posts: 684

Re: PROC Report Displays * when provided with Proc Format value

hi

 

You should add a default length like so

 

proc format fmtlib;
  value zero (default=12)
    0='-'
  ;
run;

As the format iscurrently defined, the default length is 1, this is why you get the "*"

 

The FMTLIB option will print information on the format created.

 

Bruno

Contributor
Posts: 27

Re: PROC Report Displays * when provided with Proc Format value

[ Edited ]

Thanks Bruno, your solution works.

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 211 views
  • 1 like
  • 2 in conversation