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: Stacking variables


From   daniel klein <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Stacking variables
Date   Mon, 16 Dec 2013 14:06:58 +0100

I stopped reading at

foreach var of PreturnoverEvent1-PreturnoverEvent55{

Read the help file for -foreach- to learn that
PreturnoverEvent1-PreturnoverEvent55 is, of course, not a legal list
type. You probably want

foreach var of var PreturnoverEvent1-PreturnoverEvent55 {

Also note that there should be a space between PreturnoverEvent55 and
the brace (i.e. {). There might be more errors in the code, but I
guess you should be able to catch them, reading the respective help
files caerfully.

Best
Daniel

-- 
Dear All
[...] I wrote the code below but for some 'invalid syntax' error it didn't work.

gen PreEventTurnover=.
foreach var of PreturnoverEvent1-PreturnoverEvent55{
local first=((real(substr("`var'",17,2))*371)-370)
local last=(real(substr("`var'",17,2))*371)
local c=1
forvalues d=`first'(1)`last'{
replace PreEventTurnover= `var'[`c'] in `d'
local c=`c'+1
}
}

[...]
Can anyone help?
*
*   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