Hi,
i want to loop to convert my strings data date starting by "d" into date format. But I have variables which have no data and it blocks my loop.
Here is my loop :

unab varlist : d*
foreach x in `varlist'{
gen `x'_2=date(`x',"YMD")
order `x'_2, after(`x')
format `x'_2 %dd_m_y
}


It doesn't work for variable that have 0 value (but it stops my loop...)
For example:


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte d_1 str10 d_2
. "2020-07-17"
. "2020-08-21"
. "2020-07-16"
. "2020-10-01"
end
If i do my loop, it will just stop after the first variable and change nothing
I want this with a loop :

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte d_1 float d_1_2 str10 d_2 float d_2_2
. . "2020-07-17" 22113
. . "2020-08-21" 22148
. . "2020-07-16" 22112
. . "2020-10-01" 22189
end
format %dd_m_y d_2_2

Thanks you !