Hello, I almost arrived with my solution. for use correctly the length and the size of each observation, it was necessary to browse one by one. I say almost because, when the observation size 1 of the variable var is greater than the size of the observation 2, the result in the new table test1 are same size and the processing of the observation 1 is "interrupted" and I do not understand why? data test;
length var $10.;
var='test;;:ii<';
output;
var='testj;;';
output;
run;
option symbolgen mprint mlogic;
%macro tt();
data _null_;
set test;
call symputx('nbr', _n_);
run;
%put nbr=&nbr.;
%do j=1 %to &nbr.;
data _null_;
set test(obs=&j.);
call symputx('size', length(var));
run;
data test1;
set test(obs=&j.);
%do i=1 %to &size.;
%put i=&i;
lettre=substr(var,&i.,1);
type =indexc(lettre,'3A3B3C'x);
if type
then do; substr(var,&i.,1)=translate(lettre,'414243'x,'3A3B3C'x);
end;
else do; substr(var,&i.,1)=lettre;
end;
%end;
%end;
run;
%mend;
%tt; Thank you
... View more