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

RE: st: RE: Inputting arbitrary text files into Stata datasets

From   "Nick Cox" <>
To   <>
Subject   RE: st: RE: Inputting arbitrary text files into Stata datasets
Date   Thu, 17 Oct 2002 16:28:06 +0100

Roger Newson
> >I am very curious about why you want to read columns of
> >program code into string variables. If I wanted to
> >process code or package files as text, I would do
> >it in a text editor or scripting language.
> The specific application that got me thinking along these 
> lines was website 
> maintenance. In my website (under construction at 
>   ), I have multiple 
> .htm files, 
> .toc files,  .pkg files, .zip files, .ado files and .do 
> files. When I add 
> packages to my website, I run a Stata program that reads 
> all the .pkg 
> files, collects the title line in each one, and generates 
> lists of packages 
> in the .toc files and in tables in the .htm files. A 
> package such as 
> -intext- would make it easier to add further bells and 
> whistles. However, 
> there are probably many other file-bashing applications 
> where this approach 
> would be less bother, and more reliable, than a mixture of 
> manual text 
> editing and DOS scripts.

What's practical and what's attractive to users will vary, 
but not even Windows/DOS users are limited to DOS. 
There are any number of Unix-originating programs ported to 
Windows/DOS which could make this much easier. The downside
of course is the finite time and effort needed to become 
competent in another appllication. 

> >I think quotes are easier than you think. Compound double
> >quotes don't do any harm beyond adding some visual complexity
> >to what you read. If this is not true for you, there's a bug
> >somewhere.
> See Nick Winter's second reply re the ` (left prime) character.

And, ditto, my reply, understood as role play (counsel 
for the defence to Nick Winter's prosecution counsel). 
> This is precisely the problem I am trying to get round. 
> Primes mess up 
> macro quoting, which also converts \\ , \$ and \` character 
> pairs to \ , $ 
> and ` characters, respectively. And I don't write many 
> Stata programs 
> without macros. Presumably, however, the macros used in a 
> Stata program are 
> stored somewhere, in their pre-quoted form.


Stata at the lowest level reads in everything it receives
from anywhere, the user plus -- commands, 
data, whatever -- byte by byte. 

The Stata that we mortals interact with interprets our
commands, fine except for this one small fraction 
(who knows? 0.001%?) of Stata usage. 


*   For searches and help try:

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