Statalist


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

RE: st: Re: read tempvars in user created programs


From   mario fiorini <[email protected]>
To   <[email protected]>
Subject   RE: st: Re: read tempvars in user created programs
Date   Wed, 19 Nov 2008 02:31:22 +0000

Hi Martin,
yes I know that. I am mainly trying to understand whether there is a way to have a program that sees tempvars generated externally to the program itself. The summarize command is there just as an example.

Mario 

> From: [email protected]
> To: [email protected]
> Subject: st: Re: read tempvars in user created programs
> Date: Wed, 19 Nov 2008 00:59:54 +0100
> 
> Well,
> 
> -summarize- never sees the -tempvar- that you intend to use; instead it sees 
> nothing. If -su- sees nothing, it -summarize-s everything by default, 
> including your -tempvar-...
> 
> HTH
> Martin
> _______________________
> ----- Original Message ----- 
> From: "mario fiorini" 
> To: 
> Sent: Wednesday, November 19, 2008 12:44 AM
> Subject: st: read tempvars in user created programs
> 
> 
>> 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'';
>> end;
>>
>> 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,
>>
>> Mario
>> _________________________________________________________________
>> Your dream beach house escape for summer! Sign up for the Hotmail Road 
>> Trip today.
>> http://www.ninemsn.com.au/hotmailroadtrip
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/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/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

_________________________________________________________________
Your dream beach house escape for summer! Sign up for the Hotmail Road Trip today.
http://www.ninemsn.com.au/hotmailroadtrip
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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