Hello,
I want to create groups using sales data which ranges from 400000 to 1.31e+09, I want to build groups with 100000 intervals. I tried
egen salesgroup=cut(sales) if sales>0 , at(400000(100000)3.00e+08)
But I get the following error message:
at() invalid -- invalid numlist has too many elements
Which I think crosses stata limits of elements. Then I created separate groups for a different range of values, which worked.
Question 1) Any other smarter way to deal with this?
Question 2) I am using 20 countries data, I want to use loop for each datafile (my data file are separate for each country). I tried for two countries say A and B,
foreach c in "A" "B" {
use data_country_`c', clear
sum sales, detail
egen salesgroup_`c'=cut(sales) if sales>0 , at(`r(min)'(100000)`r(p99)')
I am getting the following error: at() invalid -- invalid numlist
Any suggestions? Thanks
Shafiun
University of Nebraska-Lincoln
I want to create groups using sales data which ranges from 400000 to 1.31e+09, I want to build groups with 100000 intervals. I tried
egen salesgroup=cut(sales) if sales>0 , at(400000(100000)3.00e+08)
But I get the following error message:
at() invalid -- invalid numlist has too many elements
Which I think crosses stata limits of elements. Then I created separate groups for a different range of values, which worked.
Question 1) Any other smarter way to deal with this?
Question 2) I am using 20 countries data, I want to use loop for each datafile (my data file are separate for each country). I tried for two countries say A and B,
foreach c in "A" "B" {
use data_country_`c', clear
sum sales, detail
egen salesgroup_`c'=cut(sales) if sales>0 , at(`r(min)'(100000)`r(p99)')
I am getting the following error: at() invalid -- invalid numlist
Any suggestions? Thanks
Shafiun
University of Nebraska-Lincoln
Comment