Hi @ak2011 ,
I have added the numerator (variable "frequency") and the denominator (variable "total") in the select clause:
data m1;
set idnew1;
id_job = catx("_",id,job);
run;
proc sql;
select a.idchem,
a.frequency,
b.total,
a.frequency / b.total as percentage format=Percent8.2
from (select idchem, count(id_job) as frequency from m1 group by idchem) as a,
(select count(distinct(id_job)) as total from m1) as b;
quit;
The result is the following :
If you want to have a table rather than a report, you can add the clause "create table <dataset name> as" before the select clause in the same statement.
... View more