I have the following:
data have;
input Sl Return;
datalines;
1 4.5563
2 4.8562
3 0.0000
4 3.5879
5 0.0000
6 0.0000
7 0.0000
8 0.0000
9 2.5879
10 3.6879
run;
I know I can use PROC SQL to count observations, but I would need to do the same in a DATA step. I want:
DATA want;
set HAVE;
count number of observations if return= 0;
zero_ret_perc= (number of observations with zero returns/ total number of observations)*100;
run;
How can I achieve this?
Much thanks.