Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Printing of 0 Value

Status
Not open for further replies.

anet

Programmer
Jul 10, 2001
35
CA
How do I tell SAS not to print the value of a numeric variable if it is zero?

I have a variable called SEGNUM which I initialize to zero at the beginning of my code. Then I have statements that set the value of this variable depending upon certain conditions, so there are times it will remain at zero.

However, I do not wish 0 to print on my report. I would prefer that it just be blank. How can I do this?

Thanks.
 
Add statement

if segnum=0 then segnum=".";



prior to your print command in the data section

 
While dje's way works, that means that you change some data. You could supply a format for the var so that a blank shows in the report for zero. See example

proc format;
value zero
0 = ' ';
run;

data test;
set your_data;
segnum=0;
.... ***your code here;
format segnum zero.;
run;


Your reports should now have a blank when the value is 0. You need at least one space between quotes in the format you create ('' will not work, ' ' will work).
I hope this helps.
klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top