Hi All,
I have columns 1-n in have table ( like COL1 COL2 COL3 COL3 COL4 COL5 COL6). I want to write like this (keep=COL(1-n). Instead of writing (keep=COL1 COL2 COL3 COL3 COL4 COL5 COL6).
because I want to select 3 columns in 1 table and 10 columns in another table.
data test(keep=COL1 COL2 COL3 COL3 COL4 COL5 COL6);
set have;
run;
when using lists you need OF keyword to concat
data cc(keep=COl: )
set x;
a=cat(of col: )
ru
Do you mean a shorter way?
data test(keep=COL1-COL6);
set have;
run;
data test(keep=COL:);
set have;
run;
Variable Lists
data Test (keep = col1-col6);
data Test (keep = col:);
@sathya66 wrote:
Hi All,
I have columns 1-n in have table ( like COL1 COL2 COL3 COL3 COL4 COL5 COL6). I want to write like this (keep=COL(1-n). Instead of writing (keep=COL1 COL2 COL3 COL3 COL4 COL5 COL6).
because I want to select 3 columns in 1 table and 10 columns in another table.
data test(keep=COL1 COL2 COL3 COL3 COL4 COL5 COL6);
set have;
run;
data cc(keep=COL:);
set x;
a=cat(COL:); /*error */
run;
Please paste your code into a code box, otherwise emojis invade.
Check the link I included in my answer for examples to your new question.
@sathya66 wrote:
Thanks,
data Test (keep = col:); this way
and also I want to concatenate the variables in a single variable .
data cc(keep=COL:);
set x;
a=cat(COL:); /*error */
run;
when using lists you need OF keyword to concat
data cc(keep=COl: )
set x;
a=cat(of col: )
ru
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.