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

# st: RE: RE: RE: RE: Varlist required

 From "Francis, Richard N" To "statalist@hsphsun2.harvard.edu" Subject st: RE: RE: RE: RE: Varlist required Date Wed, 4 Dec 2013 04:30:18 +0000

```Kieran,

Guess the question is HOW do I get the scalar into `v'  ??

The pgm is working toward `v' as a r() stored value (register), but I have no clue how to get this result.

Any suggestions?

Thank you for your patience, as I am a SAS user treading in very unfamiliar territory.  :-(

Rick

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kieran McCaul
Sent: Tuesday, December 03, 2013 9:27 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: RE: Varlist required

...

Yes, as I said in my first reply, `v' is undefined.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Francis, Richard N
Sent: Wednesday, 4 December 2013 12:07 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: Varlist required

Kieran,

Thank you for the trace suggestion.

I believe this tells the error occurs in the following:

matrix b = e(b)
- matrix v = e(V)
- local coeff = b[1,1]
- local se1 = sqrt(v[1,1])
- local tstat = coeff/se
- qui foreach tstat in df {
- replace `v' = r(`v') in `i'
= replace  = r() in 1
varlist required
}
}
r(100);

Does this help us??

Rick

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kieran McCaul
Sent: Tuesday, December 03, 2013 8:55 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Varlist required

...

You don't say where the error occurred.

you could turn on -trace- by putting the following at the top of the program,  run it again and that would tell you where it is.

set tracedepth 1
set trace on

I imagine you'll find it's in the second -foreach- loop where `v' is undefined.

BTW, I don't see the point of either of the -foreach- loops: they only seem to go through once.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Francis, Richard N
Sent: Wednesday, 4 December 2013 11:37 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Varlist required

Hi Statalist,

Receive a "Varlist required" error for the following:

local limit=r(max)
foreach v in tstat {
g `v' = .
}
gen which = ""

forval i = 1/`limit' {
display "Iteration of `i' of `limit"
replace which = "`: label (id) `i''" in `i'
dfgls fcf if id == `i' , maxlag(4) ers
matrix b = e(b)
matrix v = e(V)
local coeff = b[1,1]
local se1 = sqrt(v[1,1])
local tstat = coeff/se

qui foreach tstat in df {

replace `v' = r(`v') in `i'

}
}

Any thoughts for what I am doing incorrectly?

Rick

*
*   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?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?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?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?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```