在 SAS 中用换行符替换字符串

AKS*_*AKS 1 regex sas datastep

我想读取一个文件并找到单词 \xe2\x80\x9cthe\xe2\x80\x9d 并引入换行符。即查找并替换文本\xe2\x80\x98the\xe2\x80\x99\xe2\x80\x98/nthe\xe2\x80\x99 Can you please help?

\n\n
    /*input.txt*/\n    Many a slip between the cup and the lip. \n\n    /*Required output*/\n    Many a slip between \n    the cup and \n    the lip. \n\n    /*sas datastep*/\n    data inp;\n    infile "c:/tmp/input.txt";\n    /*ADD LOGIC*/\n    infile "c:/tmp/output.txt";\n    run;\n
Run Code Online (Sandbox Code Playgroud)\n

kl7*_*l78 5

已经在评论里回答了,总结为答案

在 SAS 中有多种选项可以进行查找和替换,我建议使用tranwrd

SAS 将换行解释为“0A”x。
对于回车,您可以使用“0D”x。

所以你的解决方案是:

 test_txt =tranwrd(text,"the",cat('0A'x,"the")); 
Run Code Online (Sandbox Code Playgroud)