Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -filei- available on SSC


From   n j cox <[email protected]>
To   [email protected]
Subject   st: -filei- available on SSC
Date   Thu, 09 Aug 2007 19:09:29 +0100

Thanks to the ever-active Excelophile Kit Baum, a new package -filei-
is now available from SSC. Stata 8.2 is required.

This one-program package was a response to a question
from Hendri Adriaens on 27 July:

<http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist.0707/Author/article-811.html>

Contrary to common habit, I would like to emphasise how
little this program does. Here is most of the help.
If it doesn't put you off, use -ssc- to install.

Nick
[email protected]

-------------------------------------------------------------------------------
help for filei
-------------------------------------------------------------------------------

Write lines to end or beginning of text files

filei + [`"|"]text["|"'] ["]filename["]
filei - [`"|"]text["|"'] ["]filename["]

Description

-filei- is an immediate command (hence the suffix -i-) that can be used to add extra lines to text files.

The simple forms -filei + "text" filename- and -filei - "text" filename- add a line including text at the end (+) or at the beginning (-) of filename. The quote marks " " are not essential if text is a single 'word' (meaning, it contains no embedded spaces: Stata and 42 are both words). Conversely, quote marks around filename are essential if it includes embedded spaces. Compound double quotes `" "' around text are essential if text includes one or more embedded quote marks.

There is asymmetry: if filename does not exist, the + syntax may be used
to create a one-line file, but the - syntax returns an error.

Remarks

-filei- is deliberately minimal and designed only to fill a very small gap, as (in the author's view) this minimal task should be minimally easy to do in Stata. More elaborate problems require more elaborate commands or programs, which exist in abundance. This sentence confirms that -filei- includes no syntax to delete lines or to insert lines in the middle of files.

-filei- may be used repeatedly to write successive lines to files. That is the user's call, but be warned that it is very inefficient, as files will be opened and closed repeatedly. You should consider using (e.g.) -file- instead, or even a text editor.

*
* 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