12-13-2016 02:46 AM
I am having a pdf report on sas where some rows are having value with 0.00% or else 0.0000000. The requirement is to make that row blank if the value is 0.
Can anyone suggest me what can be done to solve the issue?
12-13-2016 02:51 AM
For display purposes, I would create character variables, and conditionally fill those variables with put() if the value is not zero. Then use the character variables in proc print or whatever.
In proc report, you can use a compute block to achieve no output when the value is zero.
12-13-2016 04:59 AM
First of all thnak you for your suggesion.
For Proc Report I have tried this one :
if index ^= '0' then do;
if maths='0' and history='0' and science='0'
text ' ';
Its not working.Can you please help me out with what is the correct one?
12-13-2016 05:09 AM
define index_char / computed; compute index_char; if index ne 0 then index_char = put(index,7.2); else index_char = " "; endcomp;
See http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#p0rb7cj6wzrl5sn0zelfb... and other examples of the report procedure.
12-13-2016 06:26 AM
12-13-2016 06:38 AM
Look at the log!
You have do statements without corresponding end statements.
And stop writing spaghetti code; proper formatting (indentation) makes the logic visible:
compute col1_char; If index_id ne 0 then do; If col1 = 0 /* assuming col1 is numeric, no quotes! */ then do; col1_char = put(col1,7.2); end; else do; col1_char = " "; end; end; endcomp;
12-13-2016 07:25 AM
12-13-2016 07:28 AM
12-13-2016 10:44 AM
One approach that may work is to use a custom format so that values of 0 display as ' '. However depending on how many columns and ranges of values you are dealing with this could become cumbersome.