我一直在尝试导出一个包含49个变量的SAS数据集.每个变量的长度可能为32767个字符.我想将此数据集写入txt文件,但SAS限制我使用lrecl32767个字符的选项.有没有办法做到这一点?我尝试使用数据步骤.
data _null_;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
%let _EFIREC_ = 0; /* clear export record count macro variable */
file 'C:path\TEST.txt';
if _n_ = 1 then do;
put "<BLAH>"
;
end;
set WORK.SAS_DATASET end=EFIEOD;
format raw1 $32767. ;
format raw2 $32767. ;
etc...
do;
EFIOUT + 1;
put raw1 $ @;
put raw2 $ @;
etc...
;
end;
if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
if EFIEOD then
do;
put "</BLAH>"
;
call symputx('_EFIREC_',EFIOUT);
end;
run;
Run Code Online (Sandbox Code Playgroud)
当然.您只需要自己指定LRECL.
filename test temp;
data _null_;
set sashelp.class;
file test lrecl=999999;
put
@1 name $32767.
@32768 sex $32767.
@65535 age 8.
;;;;
run;
Run Code Online (Sandbox Code Playgroud)
某些操作系统可能会限制您的逻辑记录长度,但在Windows中它至少为1e6,因此您应该没问题.