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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 229 views
  • 3 likes
  • 2 in conversation