我想从我创建的SAS宏中返回一个值,但我不确定如何.宏计算数据集中的观察数.我希望返回观察数量.
%macro nobs(library_name, table_name);
proc sql noprint;
select nlobs into :nobs
from dictionary.tables
where libname = UPCASE(&library_name)
and memname = UPCASE(&table_name);
quit;
*return nobs macro variable;
&nobs
%mend;
%let num_of_observations = %nobs('work', 'patients');
Run Code Online (Sandbox Code Playgroud)
另外,我希望&nobs宏中使用的宏变量对于该宏是本地的而不是全局的.我怎样才能做到这一点?
我想要一种将 julia 中的矩阵处理为新矩阵的有效(矢量化)方法,其中所有非零元素都是新矩阵中的元素。
例如,我想要这个矩阵
0 3 6 8 0
7 0 2 0 1
0 4 9 1 0
Run Code Online (Sandbox Code Playgroud)
成为
0 1 1 1 0
1 0 1 0 1
0 1 1 1 0
Run Code Online (Sandbox Code Playgroud)