- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Experts,
I am trying to substitute line feed to my character variable, in place of a pattern. I have used following attempts.
- translate(TRIM(Itemdata_Value),'0a'x,'XXXXXXXXX');
- Issue: It is creating both line feed and carriage return for some reason. i.e 2 line breaks, where I want one.
- prxchange("s/XXXXXXXXX/\n/", -1, Itemdata_Value);
- It simply replaced XXXXXXXX with text /n, not new line
Please help.
Ref:
https://communities.sas.com/t5/SAS-Procedures/SAS-new-line-symbol-character-code/td-p/27843
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Translate replaces characters from the list with equivalent characters from the replace list, not the whole word. Tranwrd is the tool for replacing a whole text string with something else. Per the manual:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000215153.htm
The prx is simply replacing the text string with the text string /n as you say, and that is correct. The /n means newline in some file formats,much like ^{newline} can be used in rtf code. Therefore the code is working, but your output renderer (rtf, pdf etc.) is either not setup to use the /n syntax, or its not valid for that renderer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use:
itemdata_value=tranwrd(itemdata_value,"XXXXXXXX",'0a'x);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If any one can clarify in this thread, then it may help someone in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Translate replaces characters from the list with equivalent characters from the replace list, not the whole word. Tranwrd is the tool for replacing a whole text string with something else. Per the manual:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000215153.htm
The prx is simply replacing the text string with the text string /n as you say, and that is correct. The /n means newline in some file formats,much like ^{newline} can be used in rtf code. Therefore the code is working, but your output renderer (rtf, pdf etc.) is either not setup to use the /n syntax, or its not valid for that renderer.