Help using Base SAS procedures

Add Leading Zero

Reply
Regular Contributor
Posts: 173

Add Leading Zero

Hello everyone,

I am reading in a numeric field (5 digit zip code). It comes in an excel doc. The leading zero is missing b/c excel doesn't keep the leading zero. Is there a way for me to add the leading zero to the 5 digit zip code (numeric) in my sas dataset?

I would like to keep it as a 'numeric' field.

Thanks for any input!
SAS Super FREQ
Posts: 8,742

Re: Add Leading Zero

Hi:
SAS does not store leading zeroes internally. However, you can ALWAYS display leading zeroes, (in procedure output) by using the Z format.
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000205244.htm

[pre]
format zipcode z5.;
[/pre]

cynthia
Regular Contributor
Posts: 173

Re: Add Leading Zero

Thank you so much, Cynthia!
Ask a Question
Discussion stats
  • 2 replies
  • 2921 views
  • 0 likes
  • 2 in conversation