Variables:
numeric: credit_value insurance_value payment
date: credit_date (daily date)
I generated variables that add up the values of 3 variables over some years, by using the following commands:
*First I generated a yearly date from a daily formatted date
gen credit_year=year(credit_date)
*Then I added up the values for a same year for 3 variables
egen yearly_credit_value= sum(credit_value), by(credit_year)
egen yearly_insurance_value=sum(insurance_value), by(credit_year)
egen yearly_payment=sum(payment), by(credit_year)
Now, I need to make the following simple operations, but I'm not really sure how to do them:
generate a variable called "probability" for each year equal to the division of yearly_payment by insurance_value
What I want is to get a table that looks like this
credit_year / yearly_credit_value / yearly_insurance_value / yearly_payment / probability
2010 / n / m / s / s/m
2011
2012
.
.
.
2019
I am also struggling to find a way to display a table with these values (I've used a tab for the variables created with egen, but there must be a more efficient way to do it) and export given table to an excel file, for example.
I know these are very basic operations, but I haven't quite been able to work throughout this simple manner.
I appreciate your help.
Related Posts with Operations with egen variables and export to Excel format
Question about AR test of xtabondDear all, I have a question about xtabond.We can use --estat abond--to do the AR test of the error …
Reshape a db in matrix formHi all, I have the following database Code: * Example generated by -dataex-. To install: ssc inst…
Panel Data Survival AnalysisI have panel data of 10 firms over 10 years. id=1,2,....,10 and t=1,2,3.....,10. Each firms joins a …
Predicted probabilities out of range after HeckmanDear all, I would like to know your opinion on the following issue I am encountering: I am running …
Reshape commandHello everybody I'd like to reshape my data from wide to long format but as the name of my variable…
Subscribe to:
Post Comments (Atom)
0 Response to Operations with egen variables and export to Excel format
Post a Comment