r equivalent of sas put statement

Can you add a small example of your two datasets to your question? That will allow folks who want to help something to work with. See some ideas for how to do this here.

A good search term for this problem that may help you find additional approaches is "lookup table". I combined that with "r" and got quite a few hits. While many resources still talk about joins as a primary option, I'm pretty sure I've seen other options using, e.g., match(). (I'm not offering a solution since I do this sort of work with joins, which jives with the way my brain thinks about this problem. :slightly_smiling_face:)

1 Like