Case-sensivity

For questions regarding programming in the EViews programming language.

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

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

Case-sensivity

Postby farrel » Fri Mar 08, 2013 4:17 am

Whether the Eviews is case-sensitive in strings?
i.e. here:
Cases 1) works, but case 2) doesn't.

1) %name_root = @left(%name_var, @instr(%name_var, "_mm"))
or
2) %name_root = @left(%name_var, @instr(%name_var, "_MM"))

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

Re: Case-sensivity

Postby EViews Gareth » Fri Mar 08, 2013 9:02 am

Yes, it is.
Follow us on Twitter @IHSEViews

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

Re: Case-sensivity

Postby farrel » Thu Mar 21, 2013 3:55 am

aha. ok.
But then, sometimes it is vice versa. Case 2) works, but Case 1) doesn't. I have few subroutines with "_MM" uppercases. I wonder how it might be?! when all the elements in workfile have lowercases... What it depends on?

1) %name_root = @left(%name_var, @instr(%name_var, "_mm"))
2) %name_root = @left(%name_var, @instr(%name_var, "_MM"))

Regards
Andrei

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

Re: Case-sensivity

Postby EViews Gareth » Thu Mar 21, 2013 7:48 am

I don't understand your question. The @instr function is case-sensitive.
Follow us on Twitter @IHSEViews

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

Re: Case-sensivity

Postby farrel » Thu Mar 21, 2013 9:00 am

Ok. let put it in an example. My confusion is the following. In the code below, I generate series ser1_mm and ser2_mm, having in mind they are lowercases. Then to subtract suffix "_mm" (lowercase) I exploit @instr with uppercase "_MM". Why "_MM" in uppercases? Note, "_mm" (lowercase) doesn't work for me later to obtain ser1_yy and ser2_yy. What forces Eviews to understand "_MM", but not "_mm"?

Code: Select all

      
smpl @all
genr ser1_mm = 0 'lowercase!!
genr ser2_mm = 0 'lowercase!!
group _gr_ser ser1_mm ser2_mm

for !C = 1 to _gr_ser.@count
   %name_endog = _gr_ser.@seriesname(!C)   
   %name_endog_root = @left(%name_endog, @instr(%name_endog, "_MM")-1) '_MM is uppercase!! why??
   genr {%name_endog_root}_yy = {!C}
next


Regards
Andrei

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

Re: Case-sensivity

Postby EViews Gareth » Thu Mar 21, 2013 9:23 am

Objects in a workfile are case insensitive. There is no difference between the series "AAA" and the series "aaa". They are the same series. You can create a series called "AAA" and it will be shown as "aaa" in the workfile. You can refer to that series as "aaa" or "AAA" and EViews will know what you mean.

Functions that work with strings are, in general, case-sensitive.

Functions that return information about objects as a string are, in general, returned in upper-case.
Follow us on Twitter @IHSEViews

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

Re: Case-sensivity

Postby farrel » Fri Mar 22, 2013 6:32 am

ok. thanks. Now I understood what the problem is. I have another example below, where I treated series name as string without refering to object, that's why in this case "_mm" (lowercases) was the solution, but not "_MM". This raised my confusion.
In turn, in previous example I treated series names as strings refering to group objects.

Code: Select all

smpl @all
genr ser1_mm = 0 'lowercase!!
call mysub("ser1_mm")

subroutine mysub(string %name_var)
   %name_endog_root = @left(%name_var, @instr(%name_var, "_mm")-1) ' Now "_mm" works, but not "_MM"
   genr {%name_endog_root}_yy = 1
endsub


But then do we have any function that extracts string referring to series name? something similar to what we have for group elements:

(from the code before)
group _gr_ser ser1_mm ser2_mm
%name_endog = _gr_ser.@seriesname(!C)

potentially might be something like this to extract series name as string:
%name_endog = ser1_mm.@seriesname

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

Re: Case-sensivity

Postby EViews Gareth » Fri Mar 22, 2013 7:51 am

All objects have a .@name data member.
Follow us on Twitter @IHSEViews

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

Re: Case-sensivity

Postby farrel » Fri Mar 22, 2013 11:02 am

Thanks.

Andrei


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 35 guests