這很可能是一個簡單的問題,但我還沒有弄明白。SAS哪裏有宏變量條款
我需要從SAS數據集檢索一些數據,其中DATE落在6個月的範圍內(例如01JAN2017到30JUN2017)我試着運行下面的代碼,但它會導致錯誤。有什麼想法嗎?我敢肯定,這是簡單的東西...
%let start1 = %Sysfunc(InputN(01JAN2017 , Date9.)) ;
%let start2 = %sysfunc(putN(&start1, date9));
%put start1 &start1 start2 &start2;
%let end1 = %sysfunc(inputn(30JUN2017,Date9.));
%let end2 = %sysfunc(putN(&end1, date9));
%put end1 &end1 end2 &end2;
proc print data=ext.account_detail (obs = 10);
where manufacturer = 'FORD' or product_segment = 'CHRYSLER'
and manufacturer_date between &start2 and &end2;
run;
結果是以下錯誤: 注:受宏觀變量「START2」行產生。
26 01JAN2017
_______
22
76
ERROR: Syntax error while parsing WHERE clause.
ERROR 22-322: Syntax error, expecting one of the following: !!, *, **, +, -, /, AND, ||.
ERROR 76-322: Syntax error, statement will be ignored.