Hi,
I have a character variables and I want to make it to 5digits by filling with zero at the starting.
ID
11
21
31
451
5671
Want:
00011
00021
00031
00451
05671
thank you in advance
This should do it:
data want; set have; id = put(input(id, 5.), z5.); run;
What is the current defined Length of the variable? If it is not at least 5 then you will not have enough character spaces to place 5 characters in it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Submit your idea!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.