I have a dataset which resembles the following:
x y
1 2
2 4
3 6
I have two variables here, x and y. I wish to calculate first the percentage change from x to y. Let us store this in another variable, z.
Code:
g z= ((y-x)/x)*100
Code:
g z1= (y-x)
export excel using "Example.xlsx", replace firstrow(variables)
What I wish to do is to not have two variables z and z1, but a single variable, say z2, which contains information on both levels and percentanges (say levels as they are, and percentages in brackets under the values in levels). Of course, this can be done on excel directly, but is there a way of doing this in Stata?
Many thanks,
CS
0 Response to Generating change in levels as well as percentages from stata
Post a Comment