Statalist The Stata Listserver


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

Re: st: How to write a program that asks the user for input


From   "Ada Ma" <[email protected]>
To   [email protected]
Subject   Re: st: How to write a program that asks the user for input
Date   Wed, 20 Jun 2007 12:36:56 +0100

Say you write a program calls "bencommands"

program define bencommands
sum income if transport = "`1'"
sum income if transport = "`2'"
sum income if transport = "`3'"
sum income if transport = "`4'"
end

if you then write:

bencommands car bus train bicycle

then you program will run and do
sum income if transport = "sum"
sum income if transport = "bus"
sum income if transport = "train"
sum income if transport = "bicycle"

If you want something more sophisticated you'll have to refer to the
course materials in NC151 and NC152.




On 6/20/07, Ben Jann <[email protected]> wrote:
Hi,

I am trying to write a program that

  first executes some commands,

  then asks the user for input,

  and then processes the user input and executes some more commands.

I tried to do something with dialogs but I cannot get the program to
wait for the user input.

Does someone know how to write a program that asks for user input and
then continues? (It does not have to be with dialogs; command line
input would be fine too.)

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


--
Ada Ma
Research Fellow
Health Economics Research Unit
University of Aberdeen, UK.
http://www.abdn.ac.uk/heru/
Tel: +44 (0) 1224 553863
Fax: +44 (0) 1224 550926
*
*   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