Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Steve Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Some basic help on programming |

Date |
Tue, 10 Apr 2012 19:41:10 -0400 |

' Prakash Singh <prakashbhu@gmail.com>: " So what I need to do is break the data item wise to get value of operating expences for different head and then merge the item wise data to get vale of total operating expences of the firm." This means to me that you want totals for one or more of the quantity and value variables for each item in level "3". Renaming each variable is unnecessary. You can do what you want with -collapse-. Here is an outline of code which you will have to tweak; only you know what use asicc_code plays in your analysis, for example. ******************************************* use "level3_list.dta", clear label define codelab 309 "Manufacturing" [....] 319 "Trade" label values item_code codelab collapse (sum) unit_quantity= unit_quantity quantity=quantity value = value, by(item_code) gen byte level =3 save totlevel3, replace ******************************************** Then append all the totlevel data sets and go on from there. To see how -collapse- works, try this: ************************ sysuse auto, clear collapse (sum) mpg=mpg price=price, by(foreign) list ***************** Steve Samuels sjsamuels@gmail.com On Apr 10, 2012, at 4:50 AM, Prakash Singh wrote: Maarten I am sorry but its not like that. For example in one lavel there is this item var in which we have ten catagory (309-3019). Each of these item is for some head of expenditute or receipt or sources of asset or sales etc. Let try again with the example of do file and sorry if I am not making myself clear. use "level3_list.dta", clear keep if item_code==309 ren item_code item_code_manu ren asicc_code asicc_code_manu ren unit_quantity unit_quantity_manu ren quantity quantity_manu ren value value_manu sort common_id save "item309.dta",replace use "level3_list.dta", clear keep if item_code==319 ren item_code item_code_trade ren asicc_code asicc_code_trade ren unit_quantity unit_quantity_trade ren quantity quantity_trade ren value value_trade sort common_id save "item319.dta",replace here item (309-319) are operating expences under different heads like manufacturing, transport, energy repair etc of the firm. So what I need to do is break the data item wise to get value of operating expences for different head and then merge the item wise data to get vale of total operating expences of the firm. Prakash * * 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/

**References**:**st: Some basic help on programming***From:*Prakash Singh <prakashbhu@gmail.com>

**Re: st: Some basic help on programming***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: Some basic help on programming***From:*Prakash Singh <prakashbhu@gmail.com>

- Prev by Date:
**RE: st: passing indefinite no of arguments** - Next by Date:
**st: Re: Concatenate files** - Previous by thread:
**Re: st: Some basic help on programming** - Next by thread:
**st: mat list** - Index(es):