I am looking for a way to remove any 0s in a character string. I've found many threads about removing *leading* zeros, but not about removing 0s in general. For example:
Data I have:
AB001234
C01403
D00003456
Data I want:
AB1234
C143
D3456
Any ideas?
Thank you in advance!
Data have;
input string $25.;
cards;
AB001234
C01403
D00003456
;
Data want;
set have;
new_string = COMPRESS (string,0 );
run;
Hi @VDD You are missing quotes around the 0. This will unnecessarily make SAS write a note to the log about the auto conversion. Just watch out for that
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.