Hi, I´m a rookie in using Stata and I am stuck at this point. I have an issue using the sum function. I have a data set of 4907 observations and I have encoded my data from string variables to numeric (long) variables. When opening the data editor I therefore now have the first variables in a kolonne with string values (colored yellow) and another new kolonne of generated numeric values (colored blue). As of earlier experience the data should be colored white (?).
The numeric variable I now have called "ncomprice" is encoded by using the following command: -encode comprice, gen(ncomprice)- because they were recognized as strings
The problem is when I am running the -sum- command on ncomprice I am not getting the mean of the values in the observations which have a range from 3,000 to 19,000 in value. Instead I get the mean or median of the number of observations, meaning I get 577,1427 when having 4907 observations. What I want is the mean of the values for each observations over time. I hope I am explaining myself good enough.
When I list the observations there are values for each observation.
As reading of some earlier posts you would probably like som info:
. describe ncomprice
storage display value
variable name type format label variable label
--------------------------------------------------------------------------
ncomprice long %9.0g ncomprice
Comprice
. count
1,156
. summarize ncomprice, detail
Comprice
-------------------------------------------------------------
Percentiles Smallest
1% 12 1
5% 58 2
10% 116 3 Obs 1,156
25% 288.5 4 Sum of Wgt. 1,156
50% 577.5 Mean 577.1427
Largest Std. Dev. 332.9293
75% 865.5 1150
90% 1038 1151 Variance 110841.9
95% 1096 1152 Skewness -.0003597
99% 1142 1153 Kurtosis 1.79956
Can someone explain what I need to do to get the summarized results I need? I would like to get the mean of the actual value of the 4907 different observations, the standard deviation, min and max value.
Thank you for your help in advance.
The numeric variable I now have called "ncomprice" is encoded by using the following command: -encode comprice, gen(ncomprice)- because they were recognized as strings
The problem is when I am running the -sum- command on ncomprice I am not getting the mean of the values in the observations which have a range from 3,000 to 19,000 in value. Instead I get the mean or median of the number of observations, meaning I get 577,1427 when having 4907 observations. What I want is the mean of the values for each observations over time. I hope I am explaining myself good enough.
When I list the observations there are values for each observation.
As reading of some earlier posts you would probably like som info:
. describe ncomprice
storage display value
variable name type format label variable label
--------------------------------------------------------------------------
ncomprice long %9.0g ncomprice
Comprice
. count
1,156
. summarize ncomprice, detail
Comprice
-------------------------------------------------------------
Percentiles Smallest
1% 12 1
5% 58 2
10% 116 3 Obs 1,156
25% 288.5 4 Sum of Wgt. 1,156
50% 577.5 Mean 577.1427
Largest Std. Dev. 332.9293
75% 865.5 1150
90% 1038 1151 Variance 110841.9
95% 1096 1152 Skewness -.0003597
99% 1142 1153 Kurtosis 1.79956
Can someone explain what I need to do to get the summarized results I need? I would like to get the mean of the actual value of the 4907 different observations, the standard deviation, min and max value.
Thank you for your help in advance.
Comment