The SAS Output Delivery System and reporting techniques

Leading zeroes

Reply
N/A
Posts: 0

Leading zeroes

Hi,

I'm trying to put leading zeroes into one of the fields & get this error.
--------------------------------

832 input dataid $ cls_lab_id $ aliquot $ type $ date $ audit $;
NOTE: SCL source line.
833 cls_lab_id = put (cls_lab_id, Z6.);
---
48
ERROR 48-59: The format $Z was not found or could not be loaded.
---------------------------------

Any idea? Thank you.
James
Contributor
Posts: 35

Re: Leading zeroes

It's because cls_lab_id is a character field, but Z6. is a numeric format. SAS tried substituting $Z. instead (i.e. a character format), but there's no such format as $Z.

You could either make appropriate use of string manipulation functions (the best idea unless you are sure there are only digits in cls_lab_id), or if it contains only digits you could say something like
cls_lab_id=(put(input(cls_lab_id,6.),Z6.);
N/A
Posts: 0

Re: Leading zeroes

Thank you!
Ask a Question
Discussion stats
  • 2 replies
  • 1537 views
  • 0 likes
  • 2 in conversation