Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Running the db command before my program continues


From   Carlos Eduardo Hernández Castillo <edu-hern@uniandes.edu.co>
To   statalist@hsphsun2.harvard.edu
Subject   st: Running the db command before my program continues
Date   Tue, 25 Oct 2005 20:13:44 -0500

I made a program in which I tried to interact with the user. I used a dialog box
in which I request the user to press a button. If the user press the button,
the .dlg program changes a global macro content. However, It does it after all
the other program runs. I would like it to do it before the program continues.

My main program is the next one:



//MAIN PROGRAM:

use "C:\Jorge\Compartirfolder\Proyectos\2005\Vivienda\vivienda_todas.dta", clear

set more on

foreach var of varlist   a1 a2  {
	global problema=0
	display "problema?" "  " "$problema"
	tab `var'
	db inspectordevariables
	more
	if $problema==1 {
		display "`var'" " " "has a problem"
	}
	display "problema?" "  " "$problema"
}

//END OF THE MAIN PROGRAM


The .dlg file is the next one:

//inspectordevariables.dlg CODE:


    VERSION 9
    POSITION 500 500 180 40


    DIALOG main,  title("Inspector de variables")
    BEGIN
		TEXT    texto 10  10 270 ., label("¿Está bien la variable?")
    END

    CANCEL can1, label("Si")
    OK     ok1, label("No") uaction(devuelveproblema)


    PROGRAM devuelveproblema
    BEGIN
		put "global problema=1"
    END


//END OF THE .DLG FILE

Thanks for your help.

CEHC
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index