data have ;
input plantype1 plantype2;
To convert to the new structure from there.
data want ;
set have ;
rename plantype1=valu1 plantype2=valu2;
The obvious question is WHY would you want to make this change?
Also why name series of variables where the number start being appended on the second name in the series. like X, X1, X2, instead of X1, X2, X3. If you use the later convention then you can use variable lists. Also it will be less confusing to the users of the data.
You've mentioned that your data has 2 variables and 3 records each. Does that mean the pattern repeats ? If it doesn't repeat, why do you need a "Do" loop ? If it repeats, do the names remain the same through out as Planttype1 and Planttype2 ?
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.