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

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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