import xls with labels

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

nlf
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am

import xls with labels

Postby nlf » Mon Jul 26, 2010 9:29 am

Hi - I am trying to import data from excel using a program rather than the import menu command and I want to tell eviews that I have three column headers and the first line contains series names. Here's what I have so far:
import %fname range="employment" colhead=3

where %fname is the name of my file. The data comes in fine but the name is all three headers rather than name, label. Data looks like this:
EEL72DC
Employment, Accommodation and Food Services, By Place of Work NAICS
REG_MTH_HIST:EEL72DC.M
1982M1 12
1982m2 15
...

any help is most appreciated.

nlf
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am

Re: import xls with labels

Postby nlf » Mon Jul 26, 2010 9:31 am

Sorry. I'm using Eviews 7

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: import xls with labels

Postby EViews Glenn » Mon Jul 26, 2010 10:06 am

Where does your "employment" range start?

nlf
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am

Re: import xls with labels

Postby nlf » Mon Jul 26, 2010 10:36 am

"employment" refers to the worksheet name. My understanding is that the import command does not necessarily need a defined range.

I know I could make it easy on myself by using the read command but I want the labels as well as the series names.

Thanks,
Norton

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

Re: import xls with labels

Postby Liu » Mon Jul 26, 2010 11:21 am

I once had the similar problem and one of the Eviews professionals here showed me the code.
It's an wfopen command as below.

wfopen(d=pagename) "C:\desktop\yourexcelfile.xls" colhead=1, range="sheet1" namepos=last

Notice that colhead doesn't clarify how many column header you have but which line you want to use as series names. if colhead=3 then that means
the third line stores the series names and the rest will go to "descriptions".

Just for your reference. Hope Eviews dudes confirm it.

nlf
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am

Re: import xls with labels

Postby nlf » Mon Jul 26, 2010 11:30 am

Great! I used namepos=first and got my series names and my labels.

Thanks for the help.

nlf
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am

Re: import xls with labels

Postby nlf » Mon Jul 26, 2010 11:37 am

correction. i just looked at the data and I got the series name and the third line of the column header as the label. My problem is that the third line is a query line and I can't put a line in between that and the data.

So this command: import %fname range="employment" colhead=3 namepos=first
for this data:
EEL72DC
Employment, Accommodation and Food Services, By Place of Work NAICS
REG_MTH_HIST:EEL72DC.M
1982M1 #N/A
1982M2 #N/A
1982M3 #N/A
1982M4 #N/A


gets me a series named EEL72DC with a label of REG_MTH_HIST:EEL72DC.M

when I want a series named EEL72DC with a label of "Employment, Accommodation and Food Services, By Place of Work NAICS"

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: import xls with labels

Postby EViews Jason » Tue Jul 27, 2010 9:34 am

Using the exact data and command you posted, I was able to get a series named EEL72DC with the description equal to "Employment, Accommodation and Food Services, By Place of Work NAICS REG_MTH_HIST:EEL72DC.M" as one line. I believe this is what you wanted.

Please make sure you have the latest version of EViews (select Help->EViews update).


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 9 guests