Sample SAS Code to Calculate the Number of Cells
/* Set the filename here,
excluding the extension,
including the already-defined libname.
*/
%let dataset=libname.inputname;
%let personid=personid;
%let firmid=firmid;
proc sort data=&dataset.(keep=&personid. &firmid.);
by &personid. &firmid.;
run;
data out;
set dot.in;
by &personid. &firmid.;
if first.&firmid. then output;
run;
%let dsid = %sysfunc(open(out));
%let nobs=%sysfunc(attrn(&dsid,nobs));
%let rc = %sysfunc(close(&dsid));
%put =================================================;
%put Your data &dataset. has &nobs. cells ;
%put =================================================;