Hi:
See this previous forum posting for an idea of how macro variable creation works in general:
http://support.sas.com/forums/thread.jspa?messageID=8249‹
and then study this modification of that previous program:
[pre]
proc sql;
select count(name) into :cntobs
from sashelp.class
where age ge 15;
quit;
%let cntobs = &cntobs;
%put cntobs= &cntobs is the number of obs in SASHELP.CLASS;
%put where age was greater than or equal to 15;
ods listing;
proc print data=sashelp.class N;
title "Students who meet the criteria: &cntobs";
where age ge 15;
run;
[/pre]
which produces this output:
[pre]
Students who meet the criteria: 5
Obs Name Sex Age Height Weight
8 Janet F 15 62.5 112.5
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
17 Ronald M 15 67.0 133.0
19 William M 15 66.5 112.0
N = 5
[/pre]
Note how the number from &CNTOBS used in the title is equal to the N= that is put into the PROC PRINT (after the detail listing).
cynthia