Writing a new text file from different series + text

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

Writing a new text file from different series + text

Postby shm83 » Wed Feb 05, 2014 5:17 am

Good afternoon. After trying many different ways, I failed to write a text file from a program.
The file should be as the one I attach, but letting the user to write in the first line whatever he/she wants.
The values would be taken from a series, and the numbers within the brackets are the index.
Thank you in advance :oops:
Attachments
Temp.txt
(621 Bytes) Downloaded 443 times

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

Re: Writing a new text file from different series + text

Postby EViews Gareth » Wed Feb 05, 2014 9:19 am

You're going to need to provide considerably more detail on what you're trying to do and what you've done so far.

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

Re: Writing a new text file from different series + text

Postby shm83 » Wed Feb 05, 2014 10:06 am

This is what I have "achieved".
What I need is that instead of the name of the series above the values, a header like this appears:
k /1*30/;
NUMBER Temp(k);
Attachments
trial.prg
Program
(249 Bytes) Downloaded 429 times
temp1.txt
Output
(559 Bytes) Downloaded 451 times
miwf.wf1
Source WF
(8.54 KiB) Downloaded 361 times

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

Re: Writing a new text file from different series + text

Postby EViews Gareth » Wed Feb 05, 2014 11:11 am

It is actually really difficult to get attributes into the top of the series when export data at the moment. This works though:

Code: Select all

'%path = @runpath 'cd %path wfopen miwf.wf1 series aa for !a=1 to 30 aa(!a)=!a next alpha bb = @str(aa) alpha cc = @str(temp) frml trial2 = "Pre('"+ bb+"') = "+cc+";" series match = @trend+3 !numobs = @obsrange+2 pagecreate(page=temp) u !numobs series match = @trend+1 copy untitled\trial2 temp\trial2 @src match @dest match smpl 1 1 trial2 = "k /1*30/;" smpl 2 2 trial2 = "Number Temp(k)" smpl @all save(type=text) "temp1.txt" nonames @keep trial2

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

Re: Writing a new text file from different series + text

Postby shm83 » Thu Feb 06, 2014 2:03 am

thanks a lot Gareth, I reckon I would not have reached to that part of the code in ages :(


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests