Code: Select all
wfopen "ulc total 2.xlsx" colhead=2
pagestack num?
rename num ulc
rename var01 year
pagestruct country @date(year)
Moderators: EViews Gareth, EViews Moderator
Code: Select all
wfopen "ulc total 2.xlsx" colhead=2
pagestack num?
rename num ulc
rename var01 year
pagestruct country @date(year)
EViews Gareth wrote:A second type of format that is used in Excel, is where the columns represent dates, then the rows represent both cross-sections and variables. Such is the case in the following:
This file can be obtain from here.
This sort of structure is a little more tricky, and takes a bit more effort inside EViews. If you bring the file in by opening it into EViews, you will get a workfile that looks like this:
The first thing we need to do is to stack this into a new page:
Notice that we use yr? as the stacking identifier since the series in EViews are all named yrXXXX.
The stack results in the following workfile page:
Now we need to unstack this page into a panel. First, though, we need to change our "Variable" series a little. This is because the text inside that variable contains spaces, and we want to create new series from this text, but series names cannot contain spaces. Thus we type the following in the command pane to create a new alpha series containing valid names:Code: Select all
alpha var2=@replace(variable," ","_")
show var2
d variable
Once this new alpha series has been created, we can do the unstack:
Now we're pretty much done. We just need to type a few more commands to tidy things up a bit (delete some un-needed series and rename some):Code: Select all
d yr
rename yr* *
And we're done!
BK03 wrote:Hi Gareth,
In the example you give below is it possible then to isolate a variable, say history of house prices in Alabama? If you open up the object house prices, the house prices appear for all the states. What if I just wanted to regress house prices in Alabama against the school budget in Alabama? Do I have to go about creating a new variable? If so, how do I do this?
Thanks!
Code: Select all
smpl if state = "Alabama"
EViews Gareth wrote:Can you provide the Excel file?
Code: Select all
wfopen gcr_pillars.xlsx
pillars = "pill_" + pillars
pageunstack pillars date
pagestack ?pill_1st @ ?* *
pagestruct var01 @date(date)
Return to “General Information and Tips and Tricks”
Users browsing this forum: No registered users and 35 guests