开发者

How do I create SAS fixed-format output containing end-of-line control characters?

I am using SAS's FILE statement to output a text file having fixed format (RECFM=F). I would like each row to end in a end-of-line control character(s) such as linefeed/carriage return. I tried the FILE statement's option TERMSTR=CRLF but still I see no end-of-line control characters in the output file. I think I could use the PUT statement to insert the desired linefeed and carriage return control characters, but would prefer a cleaner method. Is it a reasonable thing to expect of th开发者_如何学JAVAe FILE statement? (Is it a reasonable expectation for outputting fixed format data?) (Platform: Windows v6.1.7600, SAS for Windows v9.2 TS Level 2M3 W32_VSPRO platform)


Do you really need to use RECFM=F? You can still get fixed length output with V:

data _null_;
  file 'c:\temp\test.txt' lrecl=12 recfm=V;

  do i=1 to 5;
    x=rannor(123);
    put @1 i @4 x 6.4;
  end;
run;

By specifying where you want the data to go (@1 and @3) and the format (6.4) along with lrecl you will get fixed length output.

There may be a work-around, but I believe SAS won't output a line-ending with the Fixed format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜