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: Need to read a value in a stata table into a variable


From   "Subramanian, Hemang" <Hemang.Subramanian@scheller.gatech.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Need to read a value in a stata table into a variable
Date   Mon, 28 Jan 2013 21:02:17 +0000

Hi stata-listers,

  I have a stata table in the following format:
 <ac_code> <sale_date> id
  1234    1Jan2003    1
  1235    2Jan2005     2

 Id is the unique identifier for each row. Is it possible to read the  values of ac_code and sale_date into a local variable say "code" and "sd".

 I tried using foreach var in ac_code sale_date{...
....
...
}
 each time  this logic returns only the first row.. in the table.

     I need to loop through the entire stata table of approximately 40000 rows, then  use the values stored in local variables "code" & "sd"  to perform further analytics on another larger .dta file (stata file). 
 Thanks in advance.
  
warm regards.
Hemang C Subramanian
Ph.D. Candidate, Information Technology & Management,
Primary Instructor - Business Programming 
Ernest K Scheller Jr. College of Business
Georgia Tech, 800 W. Peachtree Street,
Atlanta 30318
Ph:1-404-530-9135
URI:http://bit.ly/hemangcs
*
*   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