Reputation: 69
is there a way to add a suffix to Ids based on a column? Suppose to have: For example:
ID Suffix 0001 1 0001 1 0001 1 0001 1 0001 2 0001 2 0002 1 0002 2 0002 2 0002 1 ..... ....
Desired output
ID 0001_1 0001_1 0001_1 0001_1 0001_2 0001_2 0002_1 0002_2 0002_2 0002_1 .....
Thank you in advance
Upvotes: 0
Views: 386
Reputation: 12909
Sure can! Concatenate them together using cats()
. This is assuming id
is a character. If it is numeric, you need to create a new column.
data want;
set have;
id = cats(id, '_', suffix);
run;
Upvotes: 1