Hi all,

I aim at creating a table that reports the mean of credit_rationed1 (namely, the % of credit-rationed individuals) in terms of several household characteristics (age, education, income percentile...) as row variables and years of my sample as column variables. My sample includes survey waves that run every three years from 2002 to 2017. Credit_rationed1 is a dummy variable with value 1 if the household has been rejected a loan application in the last 2 years and value = 0 if they got accepted their loan applications. Missing values mean that household did not ask for a loan in that period.

This is how my data looks like:

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float credit_rationed1 double(age education_hhead percrent) float time
. 1 1 4 2002
0 1 1 2 2002
. 1 1 1 2002
0 1 1 3 2002
0 1 1 2 2002
. 1 1 4 2002
0 1 1 4 2002
. 1 1 3 2002
. 1 1 1 2002
. 1 1 2 2002
0 1 1 4 2002
0 1 1 1 2002
0 1 1 2 2002
. 1 1 2 2002
. 1 1 2 2002
0 1 1 1 2002
. 1 1 1 2002
. 1 1 1 2002
. 1 1 3 2002
. 1 1 4 2002
. 1 1 1 2002
. 1 1 2 2002
. 1 1 5 2002
. 1 1 4 2002
0 1 1 3 2002
. 1 1 3 2002
. 1 1 3 2002
. 1 1 3 2002
. 1 1 6 2002
. 1 1 2 2002
0 1 1 2 2002
. 1 1 3 2002
. 1 1 4 2002
. 1 1 3 2002
. 1 1 3 2002
. 1 1 1 2002
. 1 1 1 2002
. 1 1 5 2002
1 1 1 1 2002
. 1 1 3 2002
. 1 1 5 2002
0 1 1 1 2002
0 1 1 3 2002
. 1 1 5 2002
. 1 1 1 2002
. 1 1 2 2002
. 1 1 2 2002
. 1 1 4 2002
0 1 1 2 2002
. 1 1 4 2002
1 1 1 3 2002
0 1 1 2 2002
0 1 1 1 2002
0 1 1 2 2002
0 1 1 5 2002
. 1 1 2 2002
. 1 1 1 2002
0 1 1 3 2002
0 1 1 3 2002
0 1 1 5 2002
. 1 1 3 2002
. 1 1 2 2002
. 1 1 4 2002
. 1 1 4 2002
. 1 1 2 2002
. 1 1 4 2002
. 1 1 4 2002
0 1 1 3 2002
. 1 1 2 2002
0 1 1 4 2002
. 1 1 1 2002
. 1 1 2 2002
. 1 1 2 2002
0 1 1 4 2002
0 1 1 3 2002
. 1 1 1 2002
. 1 1 4 2002
0 1 1 1 2002
0 1 1 3 2002
. 1 1 2 2002
. 1 1 4 2002
. 1 1 2 2002
. 1 1 3 2002
. 1 1 2 2002
. 1 1 4 2002
. 1 1 4 2002
. 1 1 2 2002
. 1 1 2 2002
0 1 1 4 2002
. 1 1 1 2002
. 1 1 1 2002
0 1 1 2 2002
. 1 1 2 2002
0 1 1 4 2002
. 1 1 3 2002
. 1 1 1 2002
0 1 1 4 2002
. 1 1 3 2002
0 1 1 3 2002
. 1 1 3 2002
end
I run the following "basic" code (did not start to edit the table yet), which did not include percrent variable:
Code:
collect: by age education_hhead time: sum credit_rationed1
collect layout (age education_hhead) (time) (result[mean])
However, Stata displays the following error message:

"Your layout specification does not uniquely match any items. One or more of the following dimensions might help uniquely match items: age, cmdset, education_hhead."

Does anybody know why is this error appearing? Any suggestions are greatly appreciated.

Best wishes,