Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: New package -inccat- on my website


From   Roger Newson <[email protected]>
To   [email protected]
Subject   st: New package -inccat- on my website
Date   Tue, 27 Aug 2002 15:36:58 +0100

Hello all

As SSC is apparently not currently being updated, I would like to announce a new package, -inccat-, on my website at http://www.kcl-phs.org.uk/rogernewson/. It will presumably be available from tomorrow by typing -findit inccat- or -net search inccat-.

-inccat- ("include and concatenate") is an extended version of -copy-, allowing the copying of multiple input text files to one output text file and, optionally, the insertion of extra input files in the output file. Therefore, if you type

inccat myinf1.txt myinf2.txt myinf3.txt,to(myoutf.txt) replace

then you copy the concatenation of -myinf1.txt-, -myinf2.txt- and -myinf3.txt- to -myoutf.txt-. And, if you type

inccat myinf1.txt myinf2.txt myinf3.txt,to(myoutf.txt) replace prefix(*insert)

and -myinf1.txt-, -myinf2.txt- annd/or -myinf3.txt- contain lines like

*insert myinf4.txt myinf5.txt

then the same concatenation is done, except that, in -myoutf.txt-, these lines will be replaced by the concatenated contents of -myinf4.txt- and -myinf5.txt-. This substitution is also done with the contents of inserted files. I find these file insertion facilities particularly useful if I am creating a HTML output file containing a table, using one HTML input file containing the table rows (which I might update regularly using my -listtex- package) and another HTML input file file containing the rest of the table (which I might update occasionally).

-inccat- is made possible by the -file- command, and also by the fact that Stata is a recursive language (like C or Pascal), in which a program can call itself. (Note for the worried: -inccat- contains safeguards to stop it from attempting to create infinite files, as might otherwise happen in the previous example if -myinf1.txt- contained lines like

*insert myinf1.txt myinf1.txt myinf1.txt

or other monstrosities.)

Best wishes

Roger

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]

Opinions expressed are those of the author, not the institution.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index