Trouble with Alpha series to Svector

For questions regarding programming in the EViews programming language.

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

abossie
Posts: 15
Joined: Tue Jan 31, 2012 10:54 am

Trouble with Alpha series to Svector

Postby abossie » Sat Jul 26, 2014 12:54 pm

I am trying to automate how my program processes a bunch of different variables. What I have done is I have set up an excel spreadsheet of my series names and labels. I want eviews to read these series names and labels for use later. I just want the name and labels in an svector, but there does not seem to be an easy way to do this. So my solution is as such:

Code: Select all

workfile .\xxx.wf1 q 1947q1 2030q4 read(b2, s=NIPA) organizeddata.xls 40 read(b2, s=business) organizeddata.xls 40 smpl 1947q1 2011q3 wfopen(s=bus_lab) .\bus.xls names=(x,y) !x=@obsrange svector(!x) name for !i= 1 to !x %hold=@elem(x, !i) name(!i)=%hold next
Then I plan on copying the string vectors over to workfile xxx. However I get the error "An unnamed object cannot converted to a string in %HOLD=@elem(x, 1). So I have two questions. 1 why am I getting this error and 2 is there an easier way to do this given that my aplha series is of different dimension/type than my xxx workfile. If you import by hand the GUI gives you the option to open a new page in the workfile and that seemed to work for adding the alpha series, but I do not see a programming option.

abossie
Posts: 15
Joined: Tue Jan 31, 2012 10:54 am

Re: Trouble with Alpha series to Svector

Postby abossie » Sat Jul 26, 2014 1:21 pm

I sloved the problem with my second question in a kind of clumsy way, but it works for me. However, I still get the "unname object error"

Code: Select all

workfile .\xxx.wf1 q 1947q1 2030q4 read(b2, s=NIPA) organizeddata.xls 40 read(b2, s=business) organizeddata.xls 40 smpl 1947q1 2011q3 pagecreate strings u 100 read(a1, s=bus_lab) .\bus.xls x $ y $ !c=0 for !y=1 to 100 if x(!y)<>"" then !c=!c+1 endif next scalar test_c=!c svector(!c) name for !i= 1 to !c %hold=@elem(x, !i) name(!i)=%hold next

abossie
Posts: 15
Joined: Tue Jan 31, 2012 10:54 am

Re: Trouble with Alpha series to Svector

Postby abossie » Sat Jul 26, 2014 1:31 pm

Ah, never mind. I found another thread that answers my question. @elem doesn't work because it returns a numeric value (?) but I did not realize that you can just access the alpha series directly so now my code is

name(!i)=x(!i)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests