Hi, I'm moving my first steps in Sas base programming. I'm trying to figure out how to solve the following problem:
id group_id id group_id
1 13456 1 13456C
2 12345 ---------> 2 12345C
3 34567 3 34567C
So, in nutshell, I want to add a character to an entire dataset variable.
Thanks
Is group_id a numeric variable? If so you can't, you cannot put non numeric characters in a numeric field. Now you can move this to a character field:
data want (drop=old_group_id); length group_id $50; set have (rename=(group_id=old_group_id)); group_id=cats(put(old_group_id,best.),"C"); run;
If group_id is character then:
data want; set have; group_id=cats(group_id,"C"); 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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.