Hi
I want to replace [ with ( in a string. But this does not work with the code:
%eq=@wreplace(%eq,"*[*", "*(*")
%eq=@wreplace(%eq,"*]*", "*)*")
where the string %eq= "0*U65+d(LOG(U65),1)=UR65+Urcon65+ucon65(1)+ucon65[2]*d(LOG(U65(-2) ) ,1)+ucon65[3]*d(LOG(U65(-10)),1)+ucon65[4]*d(LOG(x65),1)+ucon65[5]*(LOG(U65(-1)/x65(-1))-0.2*LOG(w65(-1)/pF65(-1))-0.75*LOG(pM65(-1)/pF65(-1))+0.0055757*TID)+ucon65[6]*DKV1+ucon65[7]*DUM901"
what am i doing wrong?
THomas
@wreplace(%eq,"*[*", "*(*")
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: @wreplace(%eq,"*[*", "*(*")
@wreplace replaces words. You want @replace
-
tvonbrasch
- Posts: 569
- Joined: Fri Apr 15, 2011 5:35 am
Re: @wreplace(%eq,"*[*", "*(*")
Hi
Thanks for your reply.
What do you mean by replacing words, in the help menu it states
Example:
@wreplace("ABC AB", "*B*", "*X*")
replaces all instances of “B” with “X”, returning the string “AXC AX”.
which is not a replacement of words...?
The command
show @replace("0.0055757*TID+ucon65[6]","*TID*", "*(*") also yields "0.0055757*TID+ucon65[6]"
(but the command %eq=@wreplace("0.0055757*TID+ucon65[6]","*[1]*", "*(1)*") works for some reason)
Note that the commands
show @replace("0.0055757*TID+ucon65[6]","*TID*", "*TEST*") yields "0.0055757*TID+ucon65[6]", while
show @wreplace("0.0055757*TID+ucon65[6]","*TID*", "*TEST*") yields "0.0055757*TEST+ucon65[6]"
I am a bit confused about these commands....?
Neither of them manages to replace [ with ( ?
Can you please take another look at it?
Thomas
Thanks for your reply.
What do you mean by replacing words, in the help menu it states
Example:
@wreplace("ABC AB", "*B*", "*X*")
replaces all instances of “B” with “X”, returning the string “AXC AX”.
which is not a replacement of words...?
The command
show @replace("0.0055757*TID+ucon65[6]","*TID*", "*(*") also yields "0.0055757*TID+ucon65[6]"
(but the command %eq=@wreplace("0.0055757*TID+ucon65[6]","*[1]*", "*(1)*") works for some reason)
Note that the commands
show @replace("0.0055757*TID+ucon65[6]","*TID*", "*TEST*") yields "0.0055757*TID+ucon65[6]", while
show @wreplace("0.0055757*TID+ucon65[6]","*TID*", "*TEST*") yields "0.0055757*TEST+ucon65[6]"
I am a bit confused about these commands....?
Neither of them manages to replace [ with ( ?
Can you please take another look at it?
Thomas
Last edited by tvonbrasch on Thu Aug 27, 2015 1:27 am, edited 1 time in total.
Re: @wreplace(%eq,"*[*", "*(*")
The following would yield the same output:
It does not work in your case because @wreplace considers %eq as a whole word as there are no spaces in it. And therefore it will only change the first instance (...ucon65[2]...). Do not use * or ? in @replace, since it does not look for patterns as @wreplace do.
Code: Select all
@wreplace("0.0055757*TID+ucon65[6]","*[*", "*(*")
@replace("0.0055757*TID+ucon65[6]","[", "(")-
tvonbrasch
- Posts: 569
- Joined: Fri Apr 15, 2011 5:35 am
Re: @wreplace(%eq,"*[*", "*(*")
ah, thanks, that explains it :-)
Who is online
Users browsing this forum: No registered users and 1 guest
