so my problem is the following. I am creating this difference: valore_aggiunto_`k'[1]- valore_aggiunto_`k'[15] within a for loop. This difference consists in a number. Since i = 0.02(0.05)5.5, I have 110 of these numbers.
the code generating them looks as follows:
Code:
local k=0
forvalues i = 0.02(0.05)5.5{
quietly gen v_a_`k'= median_log_sales_norm if normaliz==1
quietly replace v_a = median_log_sales_norm/(1+`i')^1 if normal==2
quietly replace v_a = median_log_sales_norm/(1+`i')^2 if normal==3
quietly replace v_a = median_log_sales_norm/(1+`i')^3 if normal==4
quietly replace v_a = median_log_sales_norm/(1+`i')^4 if normal==5
quietly egen valore_aggiunto_`k' = sum(v_a), by(Tech)
di "The diff. in valori aggiunti with tasso `i' is:"valore_aggiunto_`k'[1]- valore_aggiunto_`k'[15]
quietly drop v_a_`k' valore_aggiunto_`k'
quietly local k=`k'+1
}Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str14 Tech float(normalized_year median_log_sales_norm) "Cell" 1 .063966386 "Cell" 2 .0805286 "Cell" 3 .1054098 "Cell" 4 .12791473 "Cell" 5 .1911684 "Gene" 1 .014278216 "Gene" 2 .02447586 "Gene" 3 .03772044 "Gene" 4 .0517167 "Gene" 5 .07924227 "Monoc_antibody" 1 .008099749 "Monoc_antibody" 2 .013124235 "Monoc_antibody" 3 .016857458 "Monoc_antibody" 4 .02265201 "Monoc_antibody" 5 .031008275 end
Now, what I would like to do is to make a plot with y-axis the 110 values valore_aggiunto_`k'[1]- valore_aggiunto_`k'[15], and as x-axis the 110 values of the i (an interest rate).
I thought about defining a global variable or a tempfile, but did not manage to do that.
Can you please help me?
Thank you,
Federico
0 Response to Plotting local variables
Post a Comment