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: Looping gen sequentially over datasets
From
"Alex Sutherland" <[email protected]>
To
<[email protected]>
Subject
st: Looping gen sequentially over datasets
Date
Wed, 25 Sep 2013 17:26:41 +0100
Dear Statalisters,
I am trying to generate sequential ID variables over a series of datasets.
There are 40 datasets representing 40 schools and I want to generate an ID
variable for each school (ranging from 1-40) without the need to open and
edit each file manually. (I'm likely to have to repeat this process later
and I want to combine the datasets once the ID variable is created, hence
the need for unique identifiers for each school). I keep thinking it's going
to involve a foreach loop over the datasets combined with another loop
(forval?), but then I'm up against the limits of my Stata-ing so any help
gratefully received.
Thanks in advance,
Alex
Dr. Alex Sutherland
Research Methods Associate,
Social Sciences' Research Methods Centre (SSRMC)
http://www.ssrmc.group.cam.ac.uk/
Office 3.12
Institute of Criminology,
University of Cambridge,
Sidgwick Site
CB3 9DA
Tel: +44 (0)1223 746519
[email protected]
http://www.crim.cam.ac.uk/people/academic_research/alex_sutherland/
*
* 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/