我有一个可变长度、非常丑陋的报告文件,我正试图将其读入 SAS。读取文件记录时,我发现从文件左侧自动修剪空格。这使得将原始文件与我的数据步骤中的文件进行比较变得更加困难。如何在不进行自动修剪的情况下读取文件。
读取文件的代码
Data Test;
Infile myFile lrecl=200 firstobs=1 pad;
length line $135;
Input line $ 1 - 135;
Run;
示例文件,空格替换为 _ 以提高可见性
Num___Transaction__Comment________________________________
1_____Foo__________This_is_a_comment_about_a_transaction__
___________________foo._Line_breaks_are_fun.
2_____Bar__________Blagh_Blagh
3_____Bar__________Blagh_Blagh
4_____Foo__________Foo_transactions_have_more_comments_so
___________________they_are_harder_to_read.
输出数据集,空格替换为 _ 以获得可见性
line
-----
1_____Foo__________This_is_a_comment_about_a_transaction__
foo._Line_breaks_are_fun.
2_____Bar__________Blagh_Blagh
3_____Bar__________Blagh_Blagh
4_____Foo__________Foo_transactions_have_more_comments_so
they_are_harder_to_read.