Statalist


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

RE: st: adding -input- in an ado file


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: adding -input- in an ado file
Date   Mon, 10 Mar 2008 13:04:31 -0000

Presumably the ambiguity of -end- is the issue here. 

Svend's solution is good and may well be the best for you. 

An alternative is to read the data from a file. Another 
alternative is 

program _entryD 
	version 8 
	clear 
	set obs 2 
	gen x = cond(_n == 1, 1, 4) 
	gen y = cond(_n == 1, 2, 5) 
	gen z = cond(_n == 1, 3, 6)
end 

Naturally the implementation of that approach would be much messier 
if your real example is more complicated than what you give here. 

Nick
[email protected] 

Svend Juul replied to Zhiqiang:

The following simple program doesn't work. There may be several
alternatives to achieve the task. However, I would like to know if there
is any way to add -input- in a program.

----------------
program define _entryD
input	x y z  
	1	2	3
	4	5	6
end
end
-----------------

====================================================================

You can put the input lines in a do-file, and let the ado-file
call the do-file:

-----------------
program define _entryD
do c:\ado\personal\_entryD.do
end
-----------------


-----------------
* c:\ado\personal\_entryD.do
input	x y z  
	1	2	3
	4	5	6
end
-----------------


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