Statalist The Stata Listserver


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

st: RE: fine tuning do files


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: fine tuning do files
Date   Mon, 30 Oct 2006 16:30:08 -0000

UltraEdit is beyond my ken. 

On 2), do files can have arguments. Here is a simple example: 

----------------------------------- classic.do
regress `1' `2' 
tempvar pred 
predict `pred' 
scatter `1' `pred', xti(predicted) 
---------------------------------- 

----------------------------------- diego.do
args y x 
regress `y' `x' 
tempvar pred 
predict `pred' 
scatter `y' `pred', xti(predicted) 
---------------------------------- 

Diego can call these by 

sysuse auto, clear 
do classic mpg weight 
do diego mpg weight 

The mapping of arguments is (classically) 

first argument  -> `1' 
second argument -> `2' 
(guess what follows) 

but a simple call to -args- means you 
can set up your own more meaningful names. 

But this is all standard stuff; Diego and others
interested should now study [U] 16 and esp. [U] 
16.6.1 as it is all in The Fine Manual, including 
-args-. 

I ignored the idea of interaction with the program
in the sense of the program asking a question. You 
can do it, as documented at [P] display or in 
the corresponding help, but it's not Stataish. 
(Nor is the spelling "STATA", twenty-something years
out of date.) 

Nick 
[email protected] 

Diego Bellavia
 
> I am working on the fine-tuning of some .do files I
> have prepared for diagnostics in regression analysis
> (simple regression so far), and i have some questions
> about that: 
> 
> 1) I integrated UltraEdit and STATA as kindly reported
> by Nick Cox. 
<zap> 
> 
> 2) The scripts I have prepared are very simple and
> work pretty fine, but I have to edit them everytime I
> change the outcome and predictor(s) of the model.
> Would it be possible to have some interaction with the
> script itself ? In simple words, I would like to
> modify the script so that would be STATA to ask me
> what are the outcome (y) and predictor(s) (x or x1 x2
> x3...) and run the script consequently. Is there a way
> to create such an interaction with the program ? 

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