Hi Expert,
Is there a way to generate numeric column based on the value a string column.
for example, my string column can have the value ABC123 then I want to convert this value into a fixed value 123456 using some SAS functions or format like $hex72.
I tried to format the character column using put(column,$hex72.) but it lost precision when I further convert into a numeric column
input(put(column,$72.)).
The reason I want to do this is because our primary key is in character format (ABC123) and I need to generate a numeric primary key to represent each primary key.
Thanks
Numbers are a VERY BAD IDEA for primary keys. They are limited by the 8-byte real format, which means that any string longer than ~7 bytes will lose accuracy/precision. Stay with character storage.
UUID's can be stored reliably as 16-byte strings (use a $hex32. format for display).
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.