SAS'ta genellikle genel amaçlı makrolar yazarım. Benim makro içinde ben SAS seçeneği veya ODS seçeneğinin ayarlanıp ayarlanmadığı nasıl keşfedilir?
- makro değişkenler gibi,
- ODS seçenekleri
%macro myMac();
%let old_mac_var = &mac_var;
%let mac_var = my_variable;
%put Doing my stuf with &mac_var.;
%let mac_var = &old_mac_var;
%mend;
%let mac_var = value before;
%myMac;
%put mac_var is &mac_var;
olacak bir makro değişken için
(Elbette bu uygulamada yerel makro değişken kullanarak çözecek, ama bu ilgisi yok.)
Ama nasıl yaparım diğer ayarlar için bu mu? yani bu kodu nasıl tamamlarım?
%macro test_mprint(should_shouldNot);
data _null_;
put "NOTE: 'data _null_;' &should_shouldNot. be readable here above in the log";
run;
%mend;
%macro myMac();
%let sas_mprint = ...;
%let ods_exclude = ...;
options nomprint;
ods exclude none;
title 'CARS should be printed because of ods option exclude none';
proc print data=sashelp.class;
run;
%test_mprint(should not);
options &sas_mprint.;
ods exclude &ods_exclude.;
%mend;
options mprint;
ods exclude all;
%myMac;
title 'printing CLASS should be avoided by ods option exclude all';
proc print data=sashelp.class;
run;
%test_mprint(should);
Bu, bir yanıtın yalnızca çeyreğidir. Seçeneklerin geri alınması kolaydır, ancak bunları farklı şekilde değiştirerek seçenek ayarlarının farklı türleri vardır. –