Hello there,
I am generating new variables based on existing variables. It gives me different values whereas it should display the same values as in the existing variable.
I am wondering whether the problem does not come from the variable's type. The newly generated variable is "float" whereas the existing variable is "long".
I had to change the format of existing variables as I was not able to generate new variables. So I destring them by using the following command:
How I generated my variables:
I think the problem comes from the fact that the existing values are blue values, so is it maybe showing labels?
Take a look at "Governance" variable, the values do not match with "Governancepillarscore"

Thanks a lot for your help!
Omar
I am generating new variables based on existing variables. It gives me different values whereas it should display the same values as in the existing variable.
I am wondering whether the problem does not come from the variable's type. The newly generated variable is "float" whereas the existing variable is "long".
I had to change the format of existing variables as I was not able to generate new variables. So I destring them by using the following command:
Code:
*destring the variables needed to use the generate command as it works only with numeric values, drop and rename them automatically foreach var of varlist TotalAssets Totaldebt Cash BetaWS NetIncome EBITDA Governancepillarscore { encode `var', generate(`var'_encoded) rename `var' `var'_old rename `var'_encoded `var' drop `var'_old }
Code:
gen leverage = Totaldebt/TotalAssets gen CashSponsors = Cash/TotalAssets gen Beta = HistoricBeta gen Beta2 = BetaWS gen Profitability = NetIncome/TotalAssets gen Profitability2 = EBITDA/TotalAssets gen Size = ln(TotalAssets) gen Governance = Governancepillarscore
Take a look at "Governance" variable, the values do not match with "Governancepillarscore"
Thanks a lot for your help!
Omar
Comment