%讓vc = 12025;格式宏變量comma6
理想輸出(格式爲comma
)爲12,025
;
但%put %sysfunc(put(&vc,comma6.))
似乎無法正常工作。錯誤如下。
ERROR: The PUT function referenced in the %SYSFUNC or %QSYSFUNC macro function is not found.
%讓vc = 12025;格式宏變量comma6
理想輸出(格式爲comma
)爲12,025
;
但%put %sysfunc(put(&vc,comma6.))
似乎無法正常工作。錯誤如下。
ERROR: The PUT function referenced in the %SYSFUNC or %QSYSFUNC macro function is not found.
的PUT
功能不可用%SYSFUNC
,但是你可以使用PUTN
的數值,或PUTC
字符。
嘗試:
%put %sysfunc(putn(&vc,comma6.));
有關'%sysfunc()'和'%qsysfunc()'不可用的功能的完整列表,請參閱以下文檔:http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/ default/viewer.htm#z3514sysfunc.htm –
使用putn()
功能格式的值由%sysfunc()
返回一個替代方案是使用的%sysfunc()
鮮爲人知第二參數,如下所示:
%let vc = 12025;
%put %sysfunc(sum(&vc),comma6.);
第二觀點也適用無論函數%sysfunc()
所調用的結果的格式。在上面的例子中,我只是自己總結一個數字,它實際上只是返回數字。如果它是一個字符值,我可以使用cats()
函數。
值得注意的是,如果你想這樣做會簡化代碼:
%put %sysfunc(putn(%sysfunc(date()),date9.));
,因爲它變成了:
%put %sysfunc(date(),date9.);
爲什麼'%put%sysfunc(&vc,comma6。);'不起作用? – Lovnlust
您需要爲%sysfunc提供一個函數來工作@randombet。總和或貓只是一個「技巧」,因爲它們總是返回與輸入相同的值。 –
你是如何創建擺在首位的'vc'宏變量?宏變量是文本,因此您應該首先以正確的格式創建它。 – Joe