英文:
How to define current year as a variable in proc fedsql
问题
如何在proc fedsql中定义当前年份?
我尝试过
%let td=%sysfunc(today(),date9.);
%put &td;
%let current_year = year(&td);
%put ¤t_year;
但它不会计算并且
%let td=%sysfunc(today(),date9.);
%put &td;
%let current_year = %eval(year(&td));
%put ¤t_year;
会给我一个错误
ERROR: Required operator not found in expression: year(24JUL2023)
英文:
How can I define the current year in proc fedsql?
I tried
%let td=%sysfunc(today(),date9.);
%put &td;
%let current_year = year(&td);
%put &current_year;
which doesn't evaluate and
%let td=%sysfunc(today(),date9.);
%put &td;
%let current_year = %eval(year(&td));
%put &current_year;
which gives me the error
ERROR: Required operator not found in expression: year(24JUL2023)
答案1
得分: 1
使用 year(current_date)
proc fedsql;
select year(current_date) as "年份", *
from have
;
quit;
英文:
Use year(current_date)
proc fedsql;
select year(current_date) as "year", *
from have
;
quit;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论