有一个包含以下行的文本文件 邮件文本 = '/9j/4AAQSkZJRgABAQEAkACQAAD/4QBaRXhpZgAATU0AKgAAAAgABQMBAAUAAAABAAAASgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOwlESAAQAAAABAAAOwgAAAAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgcHBwY H';输出;
如果我读了这一行,那么文本就会被中继,它看起来像这样的文本 /9j/4AAQSkZJRgABAQEAkACQAAD/4QBaRXhpZgAATU0AKgAAAAgABQMBAAUAAAABAAAASgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOWLS AAQAAAABAAAOwgAAAAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgchHBwYH
Mailtext = 'AND';输出;被忽略。
%let work_path=.. base64.txt;
/*
content of base64.txt file 1 Line:
Mailtext = '/9j/4AAQSkZJRgABAQEAkACQAAD/4QBaRXhpZgAATU0AKgAAAAgABQMBAAUAAAABAAAASgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOwlESAAQAAAABAAAOwgAAAAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgcHBwYH';output;
*/
%macro read;
%let filrf = myImage;
%let rc=%sysfunc(filename(filrf, &work_path.));
%let fid=%sysfunc(fopen(&filrf));
%if &fid > 0 %then
%do %while(%sysfunc(fread(&fid))=0);
%let rc=%sysfunc(fget(&fid, c));
&c.
%end;
%let rc=%sysfunc(fclose(&fid));
%mend read;
%macro mail;
Data Mail;
attrib MAILTEXT LENGTH=$256;
keep Mailtext;
/* other macros inserting observations */
%read
/* other macros inserting observations */
ruN;
%mend;
%mail
不知道要设置哪些选项才能读取和插入孔线
mailtext.txt 中直接有 SAS 代码指定输出语句吗?我会跳过所有这些,并调整它以直接使用数据步骤读取它,而不是使用宏函数。
data mail;
length mailtext $256.;
infile ".../base64.txt";
input mailtext;
mailtext = dequote(scan(mailtext, 1, ';'));
run;
mailtext
/9j/4AAQSkZJRgABAQEAkACQAAD/4QBaRXhpZgAATU0AKgAAAAgABQMBAAUAAAABAAAASgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOwlESAAQAAAABAAAOwgAAAAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgcHBwYH