Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Using _request() when copy pasting from external editor


From   "Narahari H.S." <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Using _request() when copy pasting from external editor
Date   Fri, 4 Oct 2013 12:11:42 +0800 (SGT)

Hello Sergiy,

Thanks a lot. This is exactly what I was looking for. However, its not working for me. I first did -net install rs_db_utils- and then used your demo code. But I get the following from Stata. Did I miss something or do I need to install anything else? Sorry if my query is too naive :)

******************************************************************************************************

. sysuse auto

(1978 Automobile Data)
.
. inputbox a, prompt("Input value (0/1):") title("Selection") defval("0")
                 <istmt>:  3499  inputbox() not found
r(3499);
.
. summarize if (foreign==$a)
invalid syntax
r(198);
******************************************************************************************************


Thank you
Hari



----- Original Message -----
From: Sergiy Radyakin <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Sent: Thursday, 3 October 2013 10:46 PM
Subject: Re: st: Using _request() when copy pasting from external editor

No Hari, I am afraid Stata only has one buffer for user input and
would not allow you to enter input to the _request while it still has
it occupied with further lines of commands. This does look like a bug
though, since it should not matter whether a command is posted from
keyboard directly or from clipboard in a sequence of other commands.
That's up to StataCorp to fix it or describe as limitation.

As a workaround I suggest you install rs_db_utils (Stata 9.0 or newer,
any platform) and use it instead of _request:

net from http://www.radyakin.org/statalist/2013100301/

For example:
inputbox a, prompt("A=?")
(result is placed in global named 'a')

Produces a dialog like can be seen here:
http://www.radyakin.org/statalist/2013100301/demo.png

And here is your example with auto:
do http://www.radyakin.org/statalist/2013100301/demo.do
(lines can be pasted from the clipboard to resolve exactly your situation).

Hope this helps.
Best, Sergiy Radyakin









On Thu, Oct 3, 2013 at 9:43 AM, Narahari H.S. <[email protected]> wrote:
> Hello everyone,
>
> A simplified version of my code is below (I use Stata 10.1)
>
> *********************************************************
> sysuse auto
> di "Enter value (0/1): " _request(a)
> sum if foreign==$a
> *********************************************************
>
>
> The above works when I "Do" the file from the Stata Do-file editor but if I copy paste the lines from an external editor, Stata does not wait for the user input. Is there a way to make this work when I copy paste?
>
> Thank you
> Hari
>
> *
> *   For searches and help try:
> *  http://www.stata.com/help.cgi?search
> *  http://www.stata.com/support/faqs/resources/statalist-faq/
> *  http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index