Dear, The term variable value "Subject 00000000 baseline labs were collected on Day -0, 00AAA0000, instead of on Day -0 per protocol. The baseline labs should not have been drawn as the baseline visit was < 00 days from screening." is in my data under a variable name term with length 628 from excel file. I ran the code below. I suppose to get only one obs for the value with my code as the length of the value is under 200. But I am getting two obs with one all the characters of the value with length=200 and another with blank value and length=2. I am trying to remove the blank value . But I could not with "if dterm='' then delete". Thank you for your time data two;
set one;
n+1;
do i=1 to countw(term,'');
temp=scan(term,i,' ');len=length(temp)+1;output;
end;
run;
data three;
set two;
by n;
retain sum;
if first.n then sum=0;
if last.n then len=len-1;
sum+len;
if sum gt 200 then do;group+1;sum=len;end;
run;
data four;
length dterm $ 200;
do until(last.group);
set three;
by n group;
dterm=catx(' ',dterm,temp);
end; if dterm='' then delete;
run;
... View more