Dear All,
how should replace work on strings? Please consider the following code:
wfcreate(wf="file") a 1 10
series foo_1=1
series bar_1=2
group _bar bar_*
%sn_bar=_bar.@seriesname(1)
%sn_foo=@replace(%sn_bar,"bar","foo")
group __result {%sn_foo} {%sn_bar}
The group "__result" should contain the series "foo_1" and "bar_1", instead of "bar_1" and "bar_1". Is this a bug?
Thank you!
skan
Replace does not work as expected on strings
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Matt
- EViews Developer
- Posts: 583
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Replace does not work as expected on strings
Hello,
The series name returned by _bar.@seriesname(1) is in uppercase, i.e., "BAR_1", and @replace uses case-sensitive matching. Either change the case of %sn_bar or of the target string "bar" and the code will work as intended.
The series name returned by _bar.@seriesname(1) is in uppercase, i.e., "BAR_1", and @replace uses case-sensitive matching. Either change the case of %sn_bar or of the target string "bar" and the code will work as intended.
Re: Replace does not work as expected on strings
Great! Thank you!
skan
skan
Who is online
Users browsing this forum: No registered users and 2 guests
