How to concatenate tabulations in an text output file ?

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
Bertrand
Posts: 4
Joined: Mon Aug 24, 2009 8:17 am

How to concatenate tabulations in an text output file ?

Unread post by Bertrand »

Hello,

I am a programmer but new to RATS and I am trying to produce standardized output files with RATS.
The standard I have to use has been designed for other products and includes sections with tab-separated data.
When I do something like:
OPEN COPY &outputfile
DISPLAY(UNIT=COPY) "text1 text2"
where there is a tabulation between text1 and text2, no problem, the tabulation is still there in the output text file but when I write data and separate them by tabs in the same line, no matter how I try, the tab sign is replace by a single space.
I have read the following in section 4.5 of RATS User's Guide: "If you need spacing, you may need to add it, for instance, with s1+" "+s2. If there is more than one blank between the two, the extras will be removed, leaving just one blank as spacing." and I am sure my problem is related to this but this is really annoying.
Do you know a way to do what I want, maybe via another function than DISPLAY or another file type another way to concatenate strings ?

Thanks a lot in advance for your cooperation.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: How to concatenate tabulations in an text output file ?

Unread post by TomDoan »

Bertrand wrote:Hello,

I am a programmer but new to RATS and I am trying to produce standardized output files with RATS.
The standard I have to use has been designed for other products and includes sections with tab-separated data.
When I do something like:
OPEN COPY &outputfile
DISPLAY(UNIT=COPY) "text1 text2"
where there is a tabulation between text1 and text2, no problem, the tabulation is still there in the output text file but when I write data and separate them by tabs in the same line, no matter how I try, the tab sign is replace by a single space.
I have read the following in section 4.5 of RATS User's Guide: "If you need spacing, you may need to add it, for instance, with s1+" "+s2. If there is more than one blank between the two, the extras will be removed, leaving just one blank as spacing." and I am sure my problem is related to this but this is really annoying.
Do you know a way to do what I want, maybe via another function than DISPLAY or another file type another way to concatenate strings ?

Thanks a lot in advance for your cooperation.
DISPLAY won't include tabs, since it's designed for display to the text window, and has its own system for aligning columns (the @n fields). It sounds as if you might want to use REPORT to organize the information within RATS. You can then use REPORT(ACTION=SHOW,FORMAT=TDF) to create a tab delimited file.
Bertrand
Posts: 4
Joined: Mon Aug 24, 2009 8:17 am

Re: How to concatenate tabulations in an text output file ?

Unread post by Bertrand »

Thanks a lot,

I will try this.

Bertrand
Bertrand
Posts: 4
Joined: Mon Aug 24, 2009 8:17 am

Re: How to concatenate tabulations in an text output file ?

Unread post by Bertrand »

It worked with "TSD" (Tab-Separated Data, I guess) instead of "TDF" (Tab-Delimited File, by imitation of the CDF format, which was maybe too straightforward :wink: ).

I tell it for people also interested by tab-separated data and looking for it in the Reference Manual at "REPORT". I found it in the Reference Manual at "DATA" where the list of formats is more extensive.

Thanks a lot for your help,

Bertrand
Bertrand
Posts: 4
Joined: Mon Aug 24, 2009 8:17 am

Re: How to concatenate tabulations in an text output file ?

Unread post by Bertrand »

Hello,

I have another problem now.
The REPORT command works great to put tabs where I wanted but it also puts tabs where I do not want them: in empty lines for example.
I understand quite well why REPORT does that (it sees the whole report as a single big table) but I have to get rid of these unwanted tabs to be compliant with the other software I mentioned in my first message.
I tried the SPAN option of the REPORT command but finally understood that it was useless in my case: as I understand it, it lets the text span across several columns if needed but it has sense only with fixed width columns, not with columns separated by a sign, right ?
So I thought next that I would be able to produce my output file via different RATS commands used on my output file: COPY when I want no tabs and REPORT only for the section where I need tabs but unfortunately, I did not manage to open a file in APPEND mode.
Here is what I do:
OPEN (APPEND) COPY &outputfile
REPORT(ACTION=SHOW, UNIT=COPY, FORMAT=TSD)
CLOSE COPY

but it only pops a "File for COPY" window and when I select my output file, the file is overwritten.

I first thought it was a problem specific to REPORT but I get the same result with a COPY command instead of a REPORT.

What is wrong with my syntax or with my understanding of the APPEND mode ?

By the way, I now work only in DOS mode (rats32s -run) since I noticed that the error messages are more clear and the crashes less annoying in this mode.

Kind regards,

Bertrand
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: How to concatenate tabulations in an text output file ?

Unread post by TomDoan »

If you could post the post desired format (or e-mail to support@estima.com if it's sensitive), I can see what we can do.
Post Reply