Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
count = n(var1,var2...varn);
* or... *;
count = n(of var1-varn);
sum = sum(var1,var2,var3...varn);
* or... *;
sum = sum(of var1-varn);
data _null_;
var1=2;
var2 = 0;
var3 = .;
var4 = 5;
count1 = n(var1-var4);
put count1=;
count2 = n(of var1-var4);
put count2=;
run;
data test;
set your_data;
*** INIT YOUR COUNTER/SUM VARS ***;
count = 0;
total = 0;
*** ADD ONLY NUMERIC VARS TO YOUR ARRAY ***;
array t (*) _numeric_;
do i=1 to dim(t);
if t(i) > . and vname(t(i)) not in('count','total', 'i') then do;
count + 1;
total + t(i);
end;
end;
run;
proc summary data =dset1 nway;
class classvar;
var var1;
output out =temp1 n=;
run;
proc summary data =dset1 nway;
var var1;
output out=temp1 n=;
run;
data dset1;
var1 = 1;
var2 = .;
var3 = 5;
output;
var1 = .;
var2 = 2;
var3 = 4;
output;
var1 = 1;
var2 = 2;
var3 = 3;
output;
run;
proc sql;
create table blah as
select sum(var1+var2+var3) as sum
,n(var1) as n_var1
,n(var2) as n_var2
,n(var3) as n_var3
from dset1
;
quit;