I performed a sequential merge of two datasets, Dataset A and Dataset B, as I merely wished to horizontally append Dataset A to Dataset B.
Dataset A contains the following variables:
range_var_1
range_var_2
daterange_var
Dataset B contains the following variables:
obs_var_1
date_begin_var_obs
date_end_var_obs
I have also created variablename1, variablename2, variablename3….variablename304.
After the merging and the variablename creation, I wish replace the value for each variablename(1 to 304) with the result of something similar the following Excel countifs function:
=COUNTIFS(DatasetA!$A:$A,$C2,DatasetA!$M:$M,F$1,Da tasetA!$N:$N,">="&$A2,DatasetA!$N:$N,"<="&$B2)
Including the variables in the formula:
=COUNTIFS(DatasetA!range_var_1,obs_var_1, DatasetA!range_var_2, variablename, DatasetA!daterange_var, ">="date_begin_var_obs, DatasetA!daterange_var, "<=”date_end_var_obs)
So, basically, within the sequentially merged dataset, I have four criteria and four ranges on which to perform a count function using the variable values of each observation. In replacing the value for each variablename(1 to 304) with the result for the formula, variablename in the formula above would take on the name of the respective variable (literally variablename1…variablename304); ie as part of the count function, the formula would look up each variablename and count the number of occurrences of the name within the range_var_2.
I have tried egen count but this does not produce what I am looking for. Any help would be appreciated.
Dataset A contains the following variables:
range_var_1
range_var_2
daterange_var
Dataset B contains the following variables:
obs_var_1
date_begin_var_obs
date_end_var_obs
I have also created variablename1, variablename2, variablename3….variablename304.
After the merging and the variablename creation, I wish replace the value for each variablename(1 to 304) with the result of something similar the following Excel countifs function:
=COUNTIFS(DatasetA!$A:$A,$C2,DatasetA!$M:$M,F$1,Da tasetA!$N:$N,">="&$A2,DatasetA!$N:$N,"<="&$B2)
Including the variables in the formula:
=COUNTIFS(DatasetA!range_var_1,obs_var_1, DatasetA!range_var_2, variablename, DatasetA!daterange_var, ">="date_begin_var_obs, DatasetA!daterange_var, "<=”date_end_var_obs)
So, basically, within the sequentially merged dataset, I have four criteria and four ranges on which to perform a count function using the variable values of each observation. In replacing the value for each variablename(1 to 304) with the result for the formula, variablename in the formula above would take on the name of the respective variable (literally variablename1…variablename304); ie as part of the count function, the formula would look up each variablename and count the number of occurrences of the name within the range_var_2.
I have tried egen count but this does not produce what I am looking for. Any help would be appreciated.
Comment