i have a below macro program and i am unable to get the required result and understand what is going on.
%macro nsd(ArmVar = ACTARM,LstCols = %quote(USUBJID SEX AGE RACE WEIGHTBL);
%let totval=%eval(%sysfunc(countc(&LstCols,%str( )))+1);
%let LstCols_u=%sysfunc(tranwrd(&LstCols,subjid,usubjid_use)); %let LstCols_use=%sysfunc(tranwrd(&LstCols_u.,race,race_use));
data inc; set adae; length patinf $200 patlbl $500 usubjid_use $40 race_use $50; usubjid_use=scan(usubjid,3,'-'); race_use=upcase(substr(race,1,2));
%do i=1 %to &totval; %if %upcase(%scan(&LstCols_use,&i)) eq %upcase(&ArmVar.) %then %do; patinf=catx("/",patinf,&armvar.); if _n_=1 then patlbl=catx("/",patlbl,"Treatment"); %end; %else %do; patinf=catx("/",patinf,(%scan(&LstCols_use,&i))); if _n_=1 then patlbl=catx("/",patlbl,vlabel(%scan(&LstCols,&i))); %end; %end; if _n_=1 then do; call symputx("patlbl",patlbl ,'L'); run;
the thing which i am not getting is for race i am scanning and need the first 2 letters of it.
Can anyone explain what the code is doing.
... View more