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

st: read tempvars in user created programs

From   mario fiorini <>
To   <>
Subject   st: read tempvars in user created programs
Date   Tue, 18 Nov 2008 23:44:10 +0000

Dear all,
I have written a program to produce some test statistics. However, the program does not seem able to use the temporary variables
that I've generated outside of it. For illustrative purposes consider the following lines, where I define a program to summarize a tempvar (my real problem is more complex and that's why I use a program). 

 // ===================

cap program drop progtempvar; 
program define progtempvar;
    args progvars;
    di "`progvars'";
    su `TV`progvars'';

sysuse auto; 
tempvar TVprice; ge `TVprice'= price;
progtempvar price;

 // ======================

The program would not recognize the temporary variable. Is there a way to get around this without creating a non-temporary variable? 
(that is why  " reg price `TVprice' " work instead?) Thanks in advance, 

Your dream beach house escape for summer! Sign up for the Hotmail Road Trip today.
*   For searches and help try:

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