2
任何人都可以向我解释如何让PROC SQL给我的自定义函数的结果,我在函数定义中指定的长度? Datastep没有问题,但SQL给了我200个字符的默认长度。SQL不尊重我的fcmp函数长度
这里是代码,演示了这个问题:
proc fcmp outlib = work.funcs.funcs ;
* Note type/length specification ;
function testy(istr $) $11 ;
return ('bibbitybobb') ;
endsub ;
quit ;
options cmplib = work.funcs ;
data from_dstep ;
set sashelp.class ;
tes = testy(name) ;
run ;
proc sql ;
create table from_sql as
select *
, testy(name) as tes
from sashelp.class
;
describe table from_dstep ;
describe table from_sql ;
quit ;
我该日志是:
47 describe table from_dstep ;
NOTE: SQL table WORK.FROM_DSTEP was created like:
create table WORK.FROM_DSTEP(bufsize=65536)
(
Name char(8),
Sex char(1),
Age num,
Height num,
Weight num,
tes char(11)
);
48 describe table from_sql ;
NOTE: SQL table WORK.FROM_SQL was created like:
create table WORK.FROM_SQL(bufsize=65536)
(
Name char(8),
Sex char(1),
Age num,
Height num,
Weight num,
tes char(200)
);
正如你所看到的,datastep给了我11的长度对我的“TES”变量,但SQL给了我200.
有没有办法获得长度11时使用SQL?