Thank You
If you want to make the macro more flexible add parameters. You can include logic to add a default value.
You can have SAS add the default value for you if you make the parameters non-positional.
%macro patient_obs(dsn=&syslast);
....
from &dsn
....
%mend ;
Or you can add your own logic.
%macro patient_obs(dsnt);
%if 0=%length(&dsn) %then %let dsn=&syslast;
%if not %sysfunc(exist(&dsn)) %then %do;
%put &=dsn not found.;
%end;
....
from &dsn
....
%mend ;
in this code :- what is INTO:npatients trimmed nobs trimmed for ? i dont know what trimmed means in this case
%macro patient_obs() ;
%global nobs npatients ;
proc sql noprint;
select
count(enrolid) format=32.
, count(N) format=32.
into
:npatients trimmed
, :nobs trimmed
from &syslast.
;
quit ;
%put Dataset &syslast. has &nobs. observations and &npatients. patients ;
%mend patient_obs;
Apparently the new SAS 9.4 documentation is defective.
Look at the SAs 9.3 documentation instead.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.