READ command

For questions regarding programming in the EViews programming language.

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

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

READ command

Postby tchaithonov » Wed Sep 16, 2009 9:26 am

Hi All,

I am writing a program that reads csv files into eviews, but I have 2 problems that I've encountered.

1. I tried to generalized file name and variable names, so say I use %file_name and %var_name as this read command is within several for loops. The %file_name part works but %var_name does not. Eviews claims that it's a "illegal or reserved name".

This is the command I use for inserting a specific variable (with header in the csv's) into a wf:
read(c2, t=csv, name, d=c) %file_name %variable_name
2. If I change the command to read in multiple variables within a csv, Eviews is not cooperating with a scalar variable in the place of a number in the statement
read(c2, t=csv, name, d=c) %file_name !columns
Besides, putting "C2" as the starting point of the dataset doesn't seem to eliminate the columns that I don't want. In this case, I don't want it to read the first 2 columsn and start with C2. Does this thing only work if the incoming file is a xls? If that's the case, is there a workaround?

Thanks guys!

Tchaithonov

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

Re: READ command

Postby EViews Gareth » Wed Sep 16, 2009 9:47 am

The first issue is because you don't have braces around the variable name. Try

Code: Select all

read(c2, t=csv, name, d=c) %file_name {%variable_name}

I can't replicate the second issue - using a command variable works fine for me.

Entering "C2" won't work on a CSV file. You could try using the skipcol and skiprow options though.


Also, if you're using EViews 7 at all, you could try the new import command rather than the read command.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests