我正试图编写一个仅在将年龄作为参数传递时显示20-40或> = 30年龄的宏。
代码如下:
%macro detReport(p_age=);
proc sql;
create table detail as
select acct_id,
name format=$20. ,
int(yrdif(Birthday,today(),'ACTUAL')) as Age,
balance,
state,
last_Tran_date
from profile
%if &p_age ne "" %then %do;
%if %index(&p_age,-) > 0 %then %do;
where int(yrdif(Birthday,today(),'ACTUAL')) between (%scan(&p_age,1,"-") and
%scan(&p_age,2,"-"))
%end;
%end;
%else %do;
where (int(yrdif(Birthday,today(),'ACTUAL')) &p_age);
%end;
quit;
proc print data =detail ;
run;
%mend detReport;
%detReport( p_age =20-40)
该代码在传递单个值时有效(例如> = 30),但在传递20-40时给出错误。
感谢您的帮助!
P.S初学者在这里!
答案 0 :(得分:2)
为什么不让调用者通过逻辑?
images = np.zeros(shape=(1,30,30,3), dtype=np.uint8)