Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Use foreach or forvalues to create the long form data


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Use foreach or forvalues to create the long form data
Date   Thu, 16 Oct 2008 09:23:30 +0200

- h egen,seq()-


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Supnithadnaporn, Anupit
Sent: Thursday, October 16, 2008 5:12 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Use foreach or forvalues to create the long form data

Dear all,

Would you please suggest me how to create data in the long form
by *not* using reshape? I would like to avoid reshape because reshape
takes very very long time. In fact, the final & total number of records 
that I have to create would be around 12,000,000.

I think foreach and forvalues can do this work. 
But, I am a novice in Stata programming and could not figure out so far.

In the beginning, I have only Obsid which is created by

gen Obsid = _n

The desired data would look like this:

Obsid   Vid     Imp
1       1       1
2       1       2
3       1       3
4       1       4
5       2       1
6       2       2
7       2       3
8       2       4

...


100     25      4

Would anybody please help?

Thank you,

Anupit


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index