考虑以下几点:为什么MAX函数去掉proc sql中的SAS变量格式?
data;
format x datetime19.;
x=datetime();
flag='FIRST';
do x=datetime() to x+10 by 1;
output;
flag='';
end;
proc sql noprint;
select x into : test1 from &syslast where flag='FIRST';
select max(x) into: test2 from &syslast;
%put now we see that &test1 is in a different format to &test2;
data _null_; set;
put x=; /* formatted */
call symput('test3',x);
call symput('test4',max(x,sum(x+1000)));
stop;
run;
%put The data step is more consistent - &test3 = &test4;
似乎不一致给我。为什么proc sql在这种情况下保留格式?此行为是否记录在案?
此外 - 你可以修改理查德宏(http://www.devenezia.com/downloads/sas/macros/index.php?m=samelabl)将格式从一个数据集复制到另一个数据集。 –
功能 - 有道理。解释数据步骤结果(symput函数) –