Work with data from a txt file

For questions regarding programming in the EViews programming language.

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

shm83
Posts: 35
Joined: Tue Sep 10, 2013 5:00 am

Work with data from a txt file

Postby shm83 » Wed Jun 11, 2014 8:15 am

I need to save into a scalar object the result of 52.32/10.01
I tried with
read(t=dat) input.txt 2
but that creates two series objects named as the data got from the file :s

The format of the input file is like the one attached. That is the only thing I need to do with the file.
Once used (saving the result in the scalar object) I need to delete the file. Is that also possible?


Thanks in advance
Attachments
input.txt
(42 Bytes) Downloaded 663 times

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

Re: Work with data from a txt file

Postby EViews Esther » Wed Jun 11, 2014 8:42 am

I am very confused about your question. Are you trying to read your data from your ASCII file and create a new series which contains specific scalar values?

Code: Select all

read(t=dat) input.txt 2
will read data from an ASCII file *input.txt* in the default directory and show you 2 series, which are named to be SERIES01 and SERIES02.

Code: Select all

series new = series01/series02
will create a new series (names NEW) which contains the value of 52.32/10.01.

Code: Select all

delete series01 series02
will delete the series *SERIES01* and *SERIES02*, however, leave the new series *NEW*.

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

Re: Work with data from a txt file

Postby EViews Glenn » Wed Jun 11, 2014 8:44 am

Something like

Code: Select all

matrix(2,2) a a.read(t=dat) input.txt scalar val = a(1,1) / a(1,2)
should work. You can then use the shell command to get access to the operating system so you can delete the file.

shm83
Posts: 35
Joined: Tue Sep 10, 2013 5:00 am

Re: Work with data from a txt file

Postby shm83 » Wed Jun 11, 2014 8:54 am

thanks a lot.

I will do some trials with the shell command to see if I can delete the file

shm83
Posts: 35
Joined: Tue Sep 10, 2013 5:00 am

Re: Work with data from a txt file

Postby shm83 » Wed Jun 11, 2014 9:06 am

just in case anyone has this problem in the future

Code: Select all

shell del C:\Users\...\input.txt


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest