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?