problem with @makevalidname

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

maragloria
Posts: 105
Joined: Tue Jun 29, 2010 7:09 am

problem with @makevalidname

Postby maragloria » Fri Jan 31, 2025 10:00 am

Hi there,

I'm getting a problem with @makevalidname. It cleans the original string as expected, but it adds an "01" at the end of string returned.

For example:

string cleanName = @makevalidname("CSR#(USWOGGG%R,N)")
is returning "CSR__USWOGGG_R_N_01" even though eviews automatically names the series "CSR__USWOGGG_R_N_".

When I try to rename the series CSR__USWOGGG_R_N_ with another name, I get an error message since I'm searching with cleanName "CSR__USWOGGG_R_N_01" which is not found in the workfile.

I've attached the file with just the series.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13455
Joined: Tue Sep 16, 2008 5:38 pm

Re: problem with @makevalidname

Postby EViews Gareth » Fri Jan 31, 2025 10:17 am

Probably means there is already an object with that name in the workfile. @makevalid name both checks whether the name is valid, and if there is an existing object with that name. As can be seen in this example:

Code: Select all

close @wf wfcreate u 100 string cleanName = @makevalidname("CSR#(USWOGGG%R,N)") show cleanName series {cleanname} string cleanName2 = @makevalidname("CSR#(USWOGGG%R,N)") show cleanname2
Follow us on Twitter @IHSEViews

maragloria
Posts: 105
Joined: Tue Jun 29, 2010 7:09 am

Re: problem with @makevalidname

Postby maragloria » Fri Jan 31, 2025 10:22 am

Ah, I think I get what the problem is coming from.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests