DATA Step, Macro, Functions and more

Convert character to numeric to remove leading zeros

Reply
New Contributor
Posts: 2

Convert character to numeric to remove leading zeros

[ Edited ]

Hi

 

How do I convert data values like 0012345678 which are in char format to 12345678, numeric format using proc sql?

Super User
Posts: 19,851

Re: Convert character to numeric to remove leading zeros

Posted in reply to Priyanshu

Use the INPUT function. 

New Contributor
Posts: 2

Re: Convert character to numeric to remove leading zeros

[ Edited ]

Does it work in proc SQL?

Super User
Super User
Posts: 7,977

Re: Convert character to numeric to remove leading zeros

Posted in reply to Priyanshu

Yes.  In proc sql you can use SAS functions as normal.  Converting to number via input will automatically drop leading zeroes.

Super Contributor
Posts: 308

Re: Convert character to numeric to remove leading zeros

Posted in reply to Priyanshu
Ask a Question
Discussion stats
  • 4 replies
  • 355 views
  • 0 likes
  • 4 in conversation