Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Going through each observation of a variable

From   David Kantor <>
Subject   Re: st: Going through each observation of a variable
Date   Fri, 07 Jun 2013 13:38:04 -0400

Hello Derya

At 12:47 PM 6/7/2013, you wrote:
David, thanks a lot for your answer. You are right that my question was not clear. The data set has about 80,000 individuals, it is just these particular variables that represent the price scenarios have 500 observations. I would like to go through each of the 500 prices one by one, and evaluate the expression for each individual, and create a new variable for each replication (Y_`k' where k=1,..,500). Each Y_`k' will have 80,000 observations. Then I would like to summarize horizontally across replications, not across individuals. At the end, each individual will have the mean and standard deviation of the 500 different price effects. Mean (wmean) and standard deviation (wsd) will also be variables with 80,000 observations.

The code below tried to follow But actually I don't want to randomly select from 500, I want the program to go through each observation one by one, create a new variable for each replication, and take a horizontal mean and sd across replications.

I hope this is something feasible to do...


Do you mean that you have 80000 observations -- each of which has 500 price1 variables and 500 price2 variables (and similarly for os1 and os2 )?
If so, how are they named?
Or are they in long shape?
In any case, a long-shaped data structure is usually easier to work with. (That would be 40000000 observations. A lot of data either way!) Show us the data structure: what are the variables? How many observations? What is a "replication"? Are they sets of variables (wide) or observations (long)?
Let us know, and then we will have more to work with to help you.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index