Page 1 of 1

Work with data from a txt file

Posted: Wed Jun 11, 2014 8:15 am
by shm83
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

Re: Work with data from a txt file

Posted: Wed Jun 11, 2014 8:42 am
by EViews Esther
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*.

Re: Work with data from a txt file

Posted: Wed Jun 11, 2014 8:44 am
by EViews Glenn
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.

Re: Work with data from a txt file

Posted: Wed Jun 11, 2014 8:54 am
by shm83
thanks a lot.

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

Re: Work with data from a txt file

Posted: Wed Jun 11, 2014 9:06 am
by shm83
just in case anyone has this problem in the future

Code: Select all

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