Hi all, I have a dataset 'Test' with the columns type, _freq_, _freq_p and change. Need to calculate the changes for prior count in percentage and in case if Current count is zero the change should display as 100%. Example: Type _freq_ _freq_p Anc 20 20 PCP 0 30 Spc 5966 5967 Output should be Type Currentcount Priorcount change Anc 20 20 0.00% PCP 0 30 100% Spc 5966 5967 (0.02%) I tried the below code, proc report data=test ls=256 headline headskip split='*' nowd column type _freq_ _freq_p change; define _freq_/sum "CURRENT COUNT " width=20 format=comma10. spacing=1; define _freq_p/sum "PRIOR COUNT " width=20 format=comma10. spacing=1; define change/computed 'CHANGE %' width=20 format=percent8.2 spacing=1; compute change; if _freq_p.sum='' then change='1'; else change=(_freq_.sum -_freq_p.sum)/_freq_p.sum; run; But am not getting an exact answer what am expecting ? please help me out to fix this issue. Thanks in Advance.
... View more