Object Data Members

For questions regarding programming in the EViews programming language.

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

gwingard
Posts: 5
Joined: Thu Apr 15, 2010 8:04 am

Object Data Members

Postby gwingard » Tue Apr 20, 2010 9:04 am

Hello all,

How do you programmatically search within a series' object data member and alter it, and also make a group of the variables that match? For instance, let's say I have data from FRED that is nonseasonally adjusted. I wish to look within the description, find variables that are "nonseasonally adjusted", change them to "seasonally adjusted", and then make a group of the variables whose descriptions I've changed. Is this possible?

Thank you in advance for your response.

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

Re: Object Data Members

Postby EViews Gareth » Tue Apr 20, 2010 9:08 am

Your wording makes this hard to follow, but I think what you're asking about is the label information on a series, not the data members.

You can use data members to retrieve some of the label information (@name, @type, @description, @remarks etc... - check the object reference for them all). You can also set some of the label information using procs (.label, .name, .displayname)

gwingard
Posts: 5
Joined: Thu Apr 15, 2010 8:04 am

Re: Object Data Members

Postby gwingard » Tue Apr 20, 2010 10:59 am

Gareth,

Sorry about the wording. I'm a newbie to EViews programming. You're right. I was talking about setting label information by changing existing labels. Is that possible? Perhaps using the @replace command. For instance, I wish to loop through a set of variables that are not seasonally adjusted, seasonally adjust the variable, and then change the description so that "nonseasonally adjusted" becomes "seasonally adjusted". I've done something similar in FAME, but I'm moving away from that program, as EViews 7 has enhanced string functionality. Any help is appreciated. Below is a sample of the program I'm using, and needless to say it isn't working.

For %y cons leh govt
{%y}.label(d) @replace({%y}.@description, "nonseasonally adjusted", "seasonally adjusted")
next

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

Re: Object Data Members

Postby EViews Gareth » Tue Apr 20, 2010 11:09 am

No, you can set them simply with something along the lines of:

Code: Select all

%desc = x.@description y.label(d) {%desc}
which sets the description field of X into the description field of Y


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests