如何複製proc fcmp
中的vtype
功能?錯誤:VTYPE功能僅在DATA步驟中有效
proc fcmp;
have=1;
want=vtype(have);
quit;
給出:
ERROR: The VTYPE function is only valid in the DATA step. User defined libraries will be searched for a definition of this function.
溶液不應涉及掃描變量的值。
我在解決這個問題的嘗試是下面:
proc fcmp;
function vtype2 (missval $) $;
if cats(missval)='.' then return ("N");
else return("C");
endsub;
have=1;
temp=have;
call missing(temp);
want=vtype2(temp);
file log; put want=;
quit;
我不得不用vtype2
避免以下:
ERROR: Built-in SAS FUNCTION or SUBROUTINE already exists with name 'vtype'.
查詢SASHELP.VCOLUMN數據集可能是最好的選擇。 – Reeza
爲了什麼?沒有數據集。 –
你想測試什麼?在這個程序中HAVE和TEMP被定義爲數字給定了程序的寫法。那麼創建VTYPE2()子程序的價值是什麼?您可以將結果硬編碼爲WANT,因爲它不依賴於傳遞給FCMP的任何內容。 – Tom