我的问题与以下主题有关:SAS按字段检查字段。如果字段的值为0,我正在搜索设置(put)到列的字符串/变量名称的方法。有一种优雅的方法吗?
…
该 VNAME function将返回与数组引用对应的变量的名称。
VNAME
data Have; input REFERENCE_DATE L_CONTRACT L_CONTRACT_ACTIVITY L_LFC L_CONTRACT_CO_CUSTOMER L_CONTRACT_OBJECT L_CUSTOMER L_CUSTOMER_RETAIL L_DPD L_GL_ACCOUNT L_GL_AMOUNT L_EXTRA_COST L_PRODUCT; datalines; 450 1 9 8 6 0 4 3 0 0 0 0 0 ; data want; length vars_with_zero $1000; set have; array L L_CONTRACT -- L_CUSTOMER_RETAIL; * accumulate the names of the variables that have a zero value; do _n_ = 1 to dim(L); if L(_n_) = 0 then vars_with_zero = catx(' ', vars_with_zero, vname(L(_n_))); end; run;