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


From   "Dimitriy V. Masterov" <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: Need to read a value in a stata table into a variable
Date   Mon, 28 Jan 2013 13:21:38 -0800

Take a look at levelsof. Unless you have a lot of distinct values, it
should do the trick. The meaning of "a lot" is determined by your
flavor of Stata.

DVM

On Mon, Jan 28, 2013 at 1:02 PM, Subramanian, Hemang
<[email protected]> wrote:
> 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/
*
*   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