BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dustychair
Pyrite | Level 9

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;
1 ACCEPTED SOLUTION
1 REPLY 1

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 502 views
  • 3 likes
  • 2 in conversation