Hi all !

I need help on stata

I am trying to create one do file in Stata (mandatory) using 2 different Datasets. I don't want to use 2 do files.

Here is an example of what I am trying to do :

Code:
cd "C:\Lionel"
use "FirstDataset.dta"

* Display values from first dataset
sum birds
sum zone

* Graph from first dataset
#delimit;
graph twoway (scatter zone birds)
ytitle("My y title")
xtitle("My x title)
xlabel(0(10)50, alternate)
ylabel(-10(5)10, alternate)
title("Main title")
legend(label(1 "Label1") label(2 "Label2"));    

* Second dataset
use "SecondDataset.dta"

tsset date, daily

* Display values from SecondDataset to check if it is loaded as expected
sum trees

* Will display graphs for seconddataset
...
If I run my code in a SINGLE run, there is no data displayed for "trees".
However, if I run first part (FirstDataset) and then the second part (SecondDataset) by selecting the code, I can have everything displayed as expected.

It's like stata doesn't load the second dataset after the graph generation.

Is there something to add ? (I tried to add "clear" in my use instruction but does not help)

Moreover, if I remove the graph from the code, "trees" is correctly displayed. It's like generating a graph doesn't let stata load other datasets

Thanks for your help !

Regards

Lionel