View previous topic :: View next topic
|
Author |
Message |
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
We have a macro input variable like,
Code: |
%LET INPUT_TEXT = S O M E TEXT; |
All the spaces in the macro variable "INPUT_TEXT" needs to be converted into "<SP>"
For above input the output required would be,
Code: |
S<SP>O<SP><SP>M<SP>E<SP>TEXT
|
Could you please let me know how to do this,
I tried the below code, but it does not work :S
Code: |
OPTIONS SYMBOLGEN MPRINT;
%LET INPUT_TEXT = S O M E TEXT;
%MACRO REPLACE;
%LET OUTPUT_TEXT = %SYSFUNC(TRANWRD("&INPUT_TEXT","<SP>"," "));
%PUT &OUTPUT_TEXT;
%MEND;
%REPLACE; |
Log:
Code: |
SYMBOLGEN: Macro variable INPUT_TEXT resolves to S O M E TEXT
SYMBOLGEN: Macro variable OUTPUT_TEXT resolves to "S O M E TEXT"
"S O M E TEXT" |
Thanks for viewing. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello Peter,
Thanks for the link with the program.
Let me test it. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
TRANWRD(source,target,replacement)
I think you swapped target and replacement. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
The solution on the link worked well and solved the issue.
Today I learnt that TRANWRD and TRANSLATE have different order of target and replacement. Eventhough they do almost similar task.
TRANWRD(source,target string,replacement string)
TRANSLATE(source,replacement,target)
Thanks & Regards, |
|
Back to top |
|
|
|