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

st: RE: Linked datasets


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Linked datasets
Date   Fri, 26 Jul 2002 13:29:52 +0100

christopher@fergusson030481.freeserve.co.uk
> 
> Please forgive me if this is a simple question but I am 
> relatively new to STATA.  
> 
> Is it possible in STATA to have several datasets that 
> automatically feed and update another one.  I.e If i were 
> to have the populations of all the towns in a certain 
> county in seperate datasets, would it be possible to feed 
> this data into a county dataset which would automatically 
> update itself if I were to change the population of one of 
> the towns.  

I don't think so. This would be most unStataish. The whole
philosophy is that data sets should only be changed (a) directly 
and (b) explicitly and (c) one at a time. Some early official Stata
commands and many user-written commands violate (a) and (b), 
and I'm guilty myself here, but I think that increasingly violations 
of those rules are seen as undesirable in principle. 

One way of seeing this is through the Stata philosophy that 
you can (and should) keep a log of what you do so that it 
is reproducible. A log of operations on one data set 
(which led to side-effects in one or more data other sets) 
starts boggling the mind somewhat. For example, if 
you want to be able to repeat the operations reproducibly, 
then _all_ data sets must be returned to the status quo 
ante. No doubt this is all possible, but it's not at 
all clear that there would net benefits from a lot of 
work to set all this up. 

Behind all this is the question of what you want 
to store in one data set. 

The whole apparatus behind -merge- is one clear 
recognition by Stata that there can be links between 
different data sets, but similarly the machinery 
provided is centred on putting together things 
which belong together, in one data set. 

The bottom line of course is that other software
exists implementing other approaches.  

> 
> Also I am embarking upon writing several do-files and with 
> only a basic C++ programming experience would like to know 
> if there is a command that allows me to enter variables 
> into a running do-file.  For example in a certain do-file, 
> i can run it for males or females.  What would i do to have 
> stata prompt me with the question 'which sex would you like 
> to use' and then my response being recognised as the answer.

You can do this with -display _request()- or via 
-window- commands. 

For many tasks, programming an interface is of the same 
order of effort as programming the calculations, indeed 
often much more. That appears to be true of many languages, 
not only Stata. 

My advice is to get things running using standard command 
line syntax and to postpone this kind of programming 
until later. The experience of many Stata programmers 
(including do file writers) has often been that once 
they have internalised the command line way of thinking
their desire for other interfaces diminishes. 

Nick 
n.j.cox@durham.ac.uk

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index