Hi all,
I am using the below code to change variables' names. This code is changing all of the variables' names however i don't want to change first 6 variables' names. could you please give me an idea on how to modify it?
Thanks
data tr2_rlb_mat_1;
set tr_rlb_mat_1;
filename tmp temp;
data _null_;
if 0 then set tr2_rlb_mat_1;
length _vname $60;
file tmp;
put 'rename ' @;
do i=1 by 1 until (upcase(_vname)='_VNAME');
call vnext(_vname);
if upcase(_vname)='_VNAME' then leave;
put _vname +(-1) '=V' i @;
end;
put ';';
run;
proc datasets library=work nolist;
modify tr2_rlb_mat_1;
%include tmp / source2;
run;
quit;
ods select none;
Make the PUT conditional:
if i gt 6 then put _vname +(-1) '=V' i @;
Make the PUT conditional:
if i gt 6 then put _vname +(-1) '=V' i @;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.