Hello,
I would like to use the value label list exported by "fre" command in a loop to make some conditions. And, i want all values labels (including 0 freq)
How can i check in a loop if A and B are the same (or if foreign and foreign2 have same values labels, not only the same value label name).
With something like that : If A=B then display "Yes"
With my exemple, A and B are not the same (Domestic, foreign, test vs domestic and foreign) so i don't want to display "Yes". So my loop doesn't work
Thanks
I would like to use the value label list exported by "fre" command in a loop to make some conditions. And, i want all values labels (including 0 freq)
Code:
sysuse auto, clear
label define origin 0 "Domestic" 1 "Foreign" 2 "Test", replace
label define origin2 0 "Domestic" 1 "Foreign", replace
gen foreign2 = foreign
label values foreign2 origin2
fre foreign, includelabeled novalue
local A "`r(lab_valid)'"
fre foreign2, includelabeled novalue
local B "`r(lab_valid)'"
if "`A'"=="`B'" {
display "oui"
}
With something like that : If A=B then display "Yes"
With my exemple, A and B are not the same (Domestic, foreign, test vs domestic and foreign) so i don't want to display "Yes". So my loop doesn't work
Thanks

Comment