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

st: RE: RE: RE: RE: user input as scalar value

From   "Rajesh Tharyan" <>
To   <>
Subject   st: RE: RE: RE: RE: user input as scalar value
Date   Thu, 26 Jun 2008 15:40:59 +0100

Hi ,

Yes it waits for the input from the user. Also I have set up my program, as
is always recommended to  do,  in such a way that one of my original files
are changed. So it dosen't really matter at all in this context.


-----Original Message-----
[] On Behalf Of Nick Cox
Sent: 26 June 2008 15:26
Subject: st: RE: RE: RE: user input as scalar value

Not really. 

With this method, Stata waits for you to submit input. If you just press
Return, then the local macro will be empty. Depending on the program,
that is either fine -- there is a default -- or probably a fatal error
that will show up sooner or later. 

This is up to the programmer. If the programmer wants a dialog box, or
users really expect that, then that's clearly another way to proceed. 

Similarly, writing a program with options is another way to proceed. 

I had to look this up in the help. In several years' Stata programming,
I am not sure I have ever used it. So what, you may well ask. The point
is that it's there for those who want it. 

Nick Cox 

Martin Weiss

Is it at all possible to add a dialog box to this? The request could
go overlooked...

Nick Cox

Yes, you can do this. 

A canonical exchange within the do file is 

di "Enter value for foo: " _request(foo) 

after which local foo contains the value typed. 

See -help display-. 

I'd rather take arguments from the command line, but that's a matter of

Rajesh Tharyan

I have a do file, wherein I have a few scalars which I am using to
loop , as cutoff limits etc. Is it possible to have the do file 
prompt the user to input the value of the scalar, so that I do not have
make the changes to the do file.

Suppose I had a do file like

Scalar a=5
Expand a

Can I get stata to prompt the user like 

Enter the value for expansion : 
that input then gets stored as a
The code executes..

*   For searches and help try:

*   For searches and help try:

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