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]

st: loop to create varialbes


From   "Snapp, Kevin Michael" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: loop to create varialbes
Date   Thu, 6 Mar 2014 18:11:21 +0000

Hello

I need a loop that will go through my two year panel set and create the first difference for me for each variable.  I don't have a clue about these for each loops.  

Here is what I tried.

foreach x of varlist _all{
  generate d.`x' = 'x' - L1.`x'

the error msg I get is:

d.state invalid name
r(198);

I would like the new variables to have the same name as the old with a d in front to keep it easy to read.

Any help is appreciated.
Regards
Kevin Snapp
IUPUI Economics
[email protected]
317 274 5960


*
*   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