Stata Study Notes (iii): Calculation of some of the knowledge used for the standard deviation of ROA within five years

Source: Internet
Author: User

1. How to delete data for a few rows

if year2== | year2==

2. How to calculate the standard deviation for successive years

The *YEAR2 is of type int

Bys stkcd (year2): gen roa1=adjroa[_n-1]bys stkcd (year2): gen roa2=adjroa[_n-2]bys STKCD (year2): gen roa3=adjroa[_n+1]bys stkcd (year2): gen roa4=adjroa[_n+2]egen ROASD=ROWSD (roa1 roa2 adjroa roa3 roa4)

3. How to implement data import and export of Excel and Stata?

Copy and paste on the line ~

4. How do I open a CSV format file?

using " path + file name ", clear

5. How to implement grouping and averaging?

*bysort year Group is calculated in terms of years and industries, mean for averaging, Meanroa for new variable names, Egen to generate a new set of variables

bysort Year  Group:    egen meanroa=mean (ROA)

6. How do I group numbers on my data?

Egen new_id = Group (Industry)

7. Renaming variables

ren f050201b ROA

Stata Study Notes (iii): Calculation of some of the knowledge used for the standard deviation of ROA within five years

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.