I have a table with the following structure
I need to store in a new column the names of columns where in their records is 1, here is an example of what I want to do, the names of the columns can be separated with , when I store it in that new variable called list as seen in the image highlighted in yellow
This is a very difficult arrangement of data to work with, and should be avoided in most cases.
What would you do with this new variable once you have it?
I do not recommend this.
data want;
set have;
array r ACCESO_ADMIN_JUSTICIA -- SEGURIDAD_SOCIAL;
length listado $200;
do over r;
if r = 1 then listado = catx(',', listado, vname(r));
end;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.