I realise that I am answering an old question and the user may have moved on. I am adding my code in answer to this question.
The writing in BOLD is how one gets the number of columns that have a certain prefix.
Data work.temp2 ;
set work.tableappend;
by Visitlink;
array diaggg {*} diag: ; /* dynamically set the number of Diag columns from input table*/
array diag{*} diag:; /* Creating an array of length of the number of diag columns in input table */
LENGTH j 3.;
j = 1;
do until ( j > dim(diaggg));
diags = diag[j]; /* This only takes dX codes. Creates new CHAR column name diags */
j = j + 1;
IF diags NE . THEN OUTPUT;; /* This put each code on a separate line. */
end;
run;
it depends upon your dataset, if it is an excel or other csv files uploaded on some cloud then any change in the main file will automatically update your dataset.
If it is a locally created dataset then you need to add rows as per the methods described for your platform.
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.