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]

st: LA-AIDS model: saving parts of a dataset using forvalue


From   Christian OTCHIA <[email protected]>
To   [email protected]
Subject   st: LA-AIDS model: saving parts of a dataset using forvalue
Date   Sat, 13 Nov 2010 01:19:58 -0800 (PST)

Dear All,

I am running a AIDS model and I want to aggregate price and food consumption
by item.
I decided to aggregate first both price and food consumption, then  separate
the file by items and append them later.
However, my code is now working when it comes to separate files by items.
Any suggestion is welcome.

Here is my code:

* 5.  Aggregate food and price
use dataset, clear
gen price = value / quant
label var price "Price"
collapse (sum) value (sum ) price, by(id item13)
save file05, replace
* 6.  Separate file by item
use file05, clear
forv item13 = 1/13{
 keep if `item13' == `i'
 rename price p`i'
 save item_`i'
 restore, preserve
 }

1
invalid syntax
r(198);

end of do-file


Christian Otchia
-- 
View this message in context: http://statalist.1588530.n2.nabble.com/LA-AIDS-model-saving-parts-of-a-dataset-using-forvalue-tp5735067p5735067.html
Sent from the Statalist mailing list archive at Nabble.com.
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index