From numbers to letters

For questions regarding programming in the EViews programming language.

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

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

From numbers to letters

Postby tvonbrasch » Thu Sep 29, 2016 12:56 am

Hi

how can I go from a number to a letter in the alphabet?

I have a loop where i have identfied that i want to set a line in column 2. but when using the setlines command I have to specify this as column B, and not column 2.

Code: Select all

table.setlines(B) +r
If I know the number of the column I want to change, how can I easily find the appropriate letter representing that column using program code?

Thomas

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

Re: From numbers to letters

Postby tvonbrasch » Thu Sep 29, 2016 11:44 pm

The best way I have found so far is to do it manually

Code: Select all

for %col %letter 1 A 2 B 3 C 4 D 5 E 6 F .... next
Thomas

johansamuelsson
Posts: 165
Joined: Thu Mar 03, 2011 10:07 pm
Contact:

Re: From numbers to letters

Postby johansamuelsson » Fri Sep 30, 2016 7:44 am

Use @chr

Code: Select all

For !i = 1 To 26 %cl{!i} = @Chr(!i+64) Next table.setlines({%cl2}) +r
Regards Johan

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

Re: From numbers to letters

Postby tvonbrasch » Fri Sep 30, 2016 9:06 am

Perfect Johan, thanks!
Thomas


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest