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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.