Hallo,
I have a table wich contains 50 colums, 30 of which have a name which start with "ID_03_".
I would like to perform some operations only on the columns with these initial characters.
Ideally, the program wold scan the names of the colums and do
"if the name starst then "ID_03_" perform something, otherwise skip to the next column".
is it possibile?
Thank you
You haven't really said what you want to do to these columns, so I can't give you specific instructions, but perhaps a DATA step ARRAY might be useful.
Example:
data want;
set have;
array x id_03_:;
do i=1 to dim(x);
x(i)=x(i)+1; /* Do something to these columns; in this example I add 1 to the value in each column */
end;
drop i;
run;
Partial output, 3 of 10 variable pairs
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.