Hi,
I have two datasets and I want to merge them using date and company_id. However, at one dataset the company_id is type long and format %9.0g and my other dataset it is type str12 and format %12s.
Company_id variables are e.g. AEA000201011 (always a combination of letters and numbers).
I tried to make the other variable a str12 as well using:
tostring company_id, generate(company_id_n) format(%12.0f)
However, for all company_id_n observations I got 1 (and Stata said: company_id_n generated as str4).
What am I doing wrong? I think it goes wrong in the format but I am not sure.
Thanks!
I have two datasets and I want to merge them using date and company_id. However, at one dataset the company_id is type long and format %9.0g and my other dataset it is type str12 and format %12s.
Company_id variables are e.g. AEA000201011 (always a combination of letters and numbers).
I tried to make the other variable a str12 as well using:
tostring company_id, generate(company_id_n) format(%12.0f)
However, for all company_id_n observations I got 1 (and Stata said: company_id_n generated as str4).
What am I doing wrong? I think it goes wrong in the format but I am not sure.
Thanks!
Comment