Hi, I am importing 3 sheets from excel and I want to rename the list of variables with the name of each sheet
In my do I have:
cd "D:\Do\Mat"
local hojas "RB RM RA"
foreach i of local hojas {
import excel "\BDMattt2019.xlsx", sheet("`i'") firstrow clear
...
....
....
save "P_`i'.dta",replace
My vars are 20 : from INI_CDT_INT_EIB_0200_F_4 to INI_CDT_INT_EIB_4700_F_5
Using one var it would be :
rename INI_CDT_INT_EIB_0200_F_4 INI_CDT_INT_EIB_0200_F_4_R_`i',
but I want to reply this in all vars(20) for each sheet.
I want this results in my first database ( P_RB):
Id INI_CDT_INT_EIB_0200_F_4_R_RB INI_CDT_INT_EIB_4700_F_5_R_RB
1
2
3
4
.
.
.
In my second database ( P_RM):
Id INI_CDT_INT_EIB_0200_F_4_R_RM INI_CDT_INT_EIB_4700_F_5_R_RM
1
2
3
4
.
.
.
In my second database ( P_RA):
Id INI_CDT_INT_EIB_0200_F_4_R_RA INI_CDT_INT_EIB_4700_F_5_R_RA
1
2
3
4
.
.
.
Kind Regards,
Sumiko.
Related Posts with Rename the list of variables with the name of each sheet*
Compute a difference rate between two variablesHello everyone, I have to use the variables lonely and ca_couple, calculate the proportions of indi…
Perturb with MlogitHi All, I estimate a multinomial logit model with 10 independent variables. I suspect that there mi…
Control variables for intraday data.Hi everyone, I would like to add control variables (BookToMarket, Size...) to my data to regress Abn…
Different colors for graph barsHello, I have a basic doubt. I am trying to plot a graph on GDP per capita which has 2 bars- one fo…
Endogeneity concernsI am working with a dataset of about a total of 28000 observations for over a period of 10 years. I …
Subscribe to:
Post Comments (Atom)
0 Response to Rename the list of variables with the name of each sheet*
Post a Comment