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
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!
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.