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.
-
1I'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 support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/…. If that doesn't help, please post your code and some sample data.– Lauren SamuelsCommented Jul 30, 2010 at 19:16
-
but maybe you want ZDw.d format? "Writes numeric data in zoned decimal format" support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/…. I think this is signed, though, not unsigned...– Lauren SamuelsCommented Jul 30, 2010 at 19:28
Add a comment
|
1 Answer
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