Hi everyone,
I am trying to create a variable [pre], the value of which will be the correlation of two other variables [price_return and equal_weighted_return].
I tried using egen, but it generated a lot of missing values even though both the variables had values applicable. My codes were the following:
sort fiscalyear
egen pred2=corr( price_return equalweightedreturnincldivi), by(fiscalyear)
(55442 missing values generated)
I am working with a panel dataset, however if i sort the data using two identifiers [company_id and fiscalyear], I am getting more missing values.
Any suggestions to solve this easy problem?
Related Posts with Creating a variable by finding correlations of two other variables
Adding Log-rank test p-value to the Kaplan Meier graphHello everyone, I am trying to add Log-rank test p-value to my Kaplan Meier graph, but I cannot fin…
RD Graph issueHi all, My Code: scatter aux1hm aux1dm, leg(off) || line lochd0m locd0m, leg(off) lpattern(solid d…
Table with quartilesI want to create a table showing basic characteristics with the quartiles of a dependent variable, I…
Carryforward Code: * Example generated by -dataex-. To install: ssc install dataex clear input float…
Counting concurrent use of three or more types of medication within an administrative claims databaseDear Statalist, I am working to count a range of medication-related problems using an administrativ…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a variable by finding correlations of two other variables
Post a Comment