0

I am trying to write a zero padded field in a test file that a COBOL program will read using the picture clause 9(5)v999. However I am unable to find the proper format. I've tried z8.3 but SAS inserts the decimal point...ie 99.999 where as I need 00099999 as the result. Any help would be appreciated.

CW Holeman II
  • 4,661
  • 7
  • 41
  • 72
Dan Adams
  • 124
  • 2
  • 9
  • 1
    I'm not totally sure what you're trying to do, but when you say Z8.3, you are actually telling SAS to use 3 decimal places-- see http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#/documentation/cdl/en/lrdict/63026/HTML/default/a000205244.htm. If that doesn't help, please post your code and some sample data. – Lauren Samuels Jul 30 '10 at 19:16
  • but maybe you want ZDw.d format? "Writes numeric data in zoned decimal format" http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#/documentation/cdl/en/lrdict/63026/HTML/default/a000205246.htm. I think this is signed, though, not unsigned... – Lauren Samuels Jul 30 '10 at 19:28

1 Answers1

1

I believe this is what you are after:

proc format ;
  picture x low-high = '99999999' (prefix='0' mult=100);
run;

data _null_;
  do cnt = 0 to 20 by 0.5;
    put cnt x.;
  end;
run;

You can find some more examples of custom formats in this PDF:

www2.sas.com/proceedings/sugi29/236-29.pdf

Cheers Rob

Robert Penridge
  • 8,424
  • 2
  • 34
  • 55