You apparently have a character variable, since one of your sample values has the letter "V" in it.
First, and definitely foremost: why do you want to remove leading zeroes from a non-numeric variable?
Let's say you did so. Then, since your sort order is lexicographic, instead of sort order of
000999
002231
011577
with leading zeroes removed (and the remaining characters left-justified) you would have this order:
11577
2231
999
Do you really want that
This has been asked before, you could search and see if you can find the older discussions.
This is what the VERIFY function is good at.
data have;
input str $12.;
cards;
00099V67
000123
12345
;
data want;
set have;
if verify(trim(str),'0') then str=substr(str,verify(str,'0'));
run;
What does your variable represent? Leading zeroes can have meaning in character variables and could be dangerous to remove.
data have;
input str $12.;
cards;
00099V67
000123
12345
;
data want;
set have;
want=prxchange('s/^0+//',1,strip(str));
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.