Or would this work? (sorry not near my laptop for trial and and error purposes):
gen Advised = !missing(IssuerAdvisor, VendorAdvisor)
gen Advised = !missing(IssuerAdvisor, VendorAdvisor)
* Example generated by -dataex-. To install: ssc install dataex clear input int(PriceDate Proceeds) str43 IssuerAdvisor str26 VendorAdvisor byte Books str157 BooksName double perf1d 19487 80 "" "" 3 "Credit Suisse%SG Corporate & Investment Banking%Barclays" -16 20909 82 "" "" 4 "Citi%Credit Suisse%Mediobanca%UniCredit" 4.55 19500 367 "Lazard" "" 12 "Goldman Sachs%Deutsche Bank%JPMorgan%Barclays%Credit Suisse%Morgan Stanley%BNP Paribas%UBS%Citi%HSBC%SG Corporate & Investment Banking%Lazard Capital Markets" -3.13 19010 233 "" "" 3 "Bank of America Merrill Lynch%Mirabaud & Cie%Renaissance Capital" -5.22 18353 51 "" "" 2 "Canaccord Genuity Corp%Renaissance Capital" .71 20278 76 "Lazard" "" 2 "Intesa Sanpaolo SpA%Intermonte Holding SIM SpA" 32.22 19332 659 "" "" 4 "Barclays%JPMorgan%Morgan Stanley%IPOPEMA" 6.84 18571 1003 "" "" 4 "Goldman Sachs%JPMorgan%Morgan Stanley%VTB Capital" 29.96 19761 190 "" "" 2 "Credit Suisse%Banco Espirito Santo" -2.19 18382 208 "" "" 1 "Sberbank CIB" 1 end format %tdnn/dd/CCYY PriceDate label var PriceDate "PriceDate" label var Proceeds "Proceeds" label var IssuerAdvisor "IssuerAdvisor" label var VendorAdvisor "VendorAdvisor" label var Books "#Books" label var BooksName "BooksName" label var perf1d "perf1d"
replace BooksName = subinstr(BooksName,"%",char(10),.) dataex
replace BooksName = subinstr(BooksName,char(10)," ",.)
. ttest perf1d, by(advised) Two-sample t test with equal variances ------------------------------------------------------------------------------ Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- 0 | 8 2.45625 4.641376 13.12779 -8.518861 13.43136 1 | 2 14.545 17.675 24.99622 -210.0372 239.1272 ---------+-------------------------------------------------------------------- combined | 10 4.874 4.790042 15.14744 -5.961827 15.70983 ---------+-------------------------------------------------------------------- diff | -12.08875 11.96082 -39.67046 15.49296 ------------------------------------------------------------------------------ diff = mean(0) - mean(1) t = -1.0107 Ho: diff = 0 degrees of freedom = 8 Ha: diff < 0 Ha: diff != 0 Ha: diff > 0 Pr(T < t) = 0.1709 Pr(|T| > |t|) = 0.3418 Pr(T > t) = 0.8291
tab advised
Comment