-2 down vote favorite
I am having trouble with something. I have a dataset with years exporters importers and commodity codes. In order to make a panel in STATA and regress I created with the command "egen" a variable i which creates a group of importer exporter and commodity code.
Code: "egen i = group(exporter importer commodity_code)" I successfully created a panel set with i and year, generated the logarithmic forms of my variables and regressed getting great estimations. So, I have my current dataset (with the logs and the i etc) and I need to find the centered (mean) values of each group. I can do it in SAS, as I create a second dataset with the centered values and then merge it with the original to have the centered values inside along with the real ones. How can I do this in STATA?
Here is the code from SAS: (Datafors is the dataset's name I import in SAS)
data Sas1; retain exporter importer COMMODIT year; set Datafors; proc sort; by exporter importer COMMODIT; run; proc means data=Sas1 noprint; var IGDP IGDPCAP ICPI ; OUTPUT OUT=sas3 mean=IGDP IGDPCAP ICPI ; by exporter importer COMMODIT;id I; run; data sas3; set sas3; drop _TYPE_ _FREQ_; run; data sas4; set sas2 sas3; proc sort; by exporter importer commodit year; run; I want the means so when I will re-estimate I will get the predicted ones.
Thanks in advance
Comment