這裏有幾個可能的方法:
data _null_;
ref = 001;
inceptiondate = '01jan1960'd;
lossdate = '01jun1960'd;
format inceptiondate lossdate yymmdd10.;
/*Without indent*/
PUT 'WARNING: ' ref ' inception date prior to the loss date!'/ref=/InceptionDate=/LossDate=;
/*Move the pointer to the right by 1 before printing*/
PUT 'WARNING: ' ref ' inception date prior to the loss date!'/+1 ref=/+1 InceptionDate=/+1 LossDate=;
/*Move the pointer to column 2 before printing*/
PUT 'WARNING: ' ref ' inception date prior to the loss date!'/@2 ref=/@2 InceptionDate=/@2 LossDate=;
/*# of spaces seems to depend on where you put the tab characters in the line containing the put statement*/
PUT 'WARNING: ' ref ' inception date prior to the loss date!'/' ' ref=/' ' InceptionDate=/' ' LossDate=;
/*Works in external text editor but not in the SAS log window*/
PUT 'WARNING: ' ref ' inception date prior to the loss date!'/'09'x ref=/'09'x InceptionDate=/'09'x LossDate=;
run;
注
我不知道怎麼去這個網站能夠正常顯示製表符 - 第三種方法涉及編寫了包含標籤代碼單引號中的字符。如果您複製並粘貼上面顯示的代碼,則會得到空格。在SAS中,在代碼運行之前將製表符轉換爲空格,因此您在日誌中縮進的數量取決於代碼中的製表符的位置,而日誌包含空格而不是製表符。
如果您使用'09'x方法,如果您通過proc printto log = "c:\temp\my.log"; run;
將日誌重定向到外部文件並在您喜歡的文本編輯器中查看它,但SAS日誌窗口(至少在9.1.3中)不支持製表符 - 它們被視爲單個不可打印字符,顯示爲矩形。
「@ 2」是什麼? – JustinJDavies 2014-09-03 08:30:53
@ 2將指針移動到行上的第二個字符位置。 +1從當前位置移動1個字符。 – vasja 2014-09-03 08:39:05
如果你真的想要一個製表符,我喜歡「09x」方法。如果你只想縮進我喜歡'@#'選項。 – Joe 2014-09-03 12:16:04