
Rick A. answered 04/20/19
Experienced SAS Professional
data raa;
input id $ score;
datalines;
01 1
02 2
03 3
04 4
;
run;
data _null_;
set raa nobs=totobs end=eof;
if eof then call symputx('N', totobs);
run;
%put hold N=&N;
Rick A. answered 04/20/19
Experienced SAS Professional
data raa;
input id $ score;
datalines;
01 1
02 2
03 3
04 4
;
run;
data _null_;
set raa nobs=totobs end=eof;
if eof then call symputx('N', totobs);
run;
%put hold N=&N;
Alexander D. answered 03/15/19
Experienced Quantitative Analytics Specialist
The most straighforward way to do this:
proc sql;
select count(*)
from yourtable;
quit;
If you need to store it:
proc sql;
select count(*) into :myvarcount
from yourtable;
quit;
This create a macro variable that can be referenced, e.g.:
%put &myvarcount.;
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.