Hello All,

I am learning STATA and have not been able to find the answer to the following question online:

What syntax do I use in Stata to generate a variable that requires multiple conditions? Here is what I'm trying to use and it's not working:


Q) Need help with getting the variables that have the given entries I have 50 variables and more then 150 data entries to fetch from the dataset kindly help me with it


browse * if inrange(I10_DX1,"F1110","F1199") |inrange(I10_DX2,"F1110","F1199") |inrange(I10_DX3,"F1110","F1199") |inrange(I10_DX4,"F1110","F1199") |inrange(I10_DX5,"F1110","F1199") |inrange(I10_DX6,"F1110","F1199")|inrange(I10_DX7, "T400X1A","T40695D") |inrange(I10_DX8,"F1110","F1199") |inrange(I10_DX9,"F1110","F1199") |inrange(I10_DX10,"F1110","F1199") |inrange(I10_DX11,"F1110","F1199") |inrange(I10_DX12,"F1110","F1199") |inrange(I10_DX13,"F1110","F1199") |inrange(I10_DX14,"F1110","F1199") |inrange(I10_DX15,"F1110","F1199") |inrange(I10_DX16,"F1110","F1199") |inrange(I10_DX17,"F1110","F1199") |inrange(I10_DX18,"F1110","F1199") |inrange(I10_DX19,"F1110","F1199") |inrange(I10_DX20,"F1110","F1199") |inrange(I10_DX21,"F1110","F1199") |inrange(I10_DX22,"F1110","F1199") |inrange(I10_DX23,"F1110","F1199") |inrange(I10_DX24,"F1110","F1199") |inrange(I10_DX25,"F1110","F1199") |inrange(I10_DX26,"F1110","F1199") |inrange(I10_DX27,"F1110","F1199") |inrange(I10_DX28,"F1110","F1199") |inrange(I10_DX29,"F1110","F1199") |inrange(I10_DX30,"F1110","F1199")| inrange(I10_DX1,"T400X1A","T40695D")| inrange(I10_DX2,"T400X1A","T40695D")| inrange(I10_DX3,"T400X1A","T40695D")| inrange(I10_DX4,"T400X1A","T40695D")| inrange(I10_DX5,"T400X1A","T40695D")| inrange(I10_DX6,"T400X1A","T40695D")| inrange(I10_DX7,"T400X1A","T40695D")| inrange(I10_DX8,"T400X1A","T40695D")| inrange(I10_DX9,"T400X1A","T40695D")| inrange(I10_DX10,"T400X1A","T40695D")| inrange(I10_DX11,"T400X1A","T40695D")| inrange(I10_DX12,"T400X1A","T40695D")| inrange(I10_DX13,"T400X1A","T40695D")| inrange(I10_DX14,"T400X1A","T40695D")| inrange(I10_DX15,"T400X1A","T40695D")| inrange(I10_DX16,"T400X1A","T40695D")| inrange(I10_DX17,"T400X1A","T40695D")| inrange(I10_DX18,"T400X1A","T40695D")| inrange(I10_DX19,"T400X1A","T40695D")| inrange(I10_DX20,"T400X1A","T40695D")| inrange(I10_DX21,"T400X1A","T40695D")| inrange(I10_DX22,"T400X1A","T40695D")| inrange(I10_DX23,"T400X1A","T40695D")| inrange(I10_DX24,"T400X1A","T40695D")| inrange(I10_DX25,"T400X1A","T40695D")| inrange(I10_DX26,"T400X1A","T40695D")| inrange(I10_DX27,"T400X1A","T40695D")| inrange(I10_DX28,"T400X1A","T40695D")| inrange(I10_DX129,"T400X1A","T40695D")| inrange(I10_DX30,"T400X1A","T40695D")



Q) While using inlist function, I am able to give only 10 inputs. but I have more than 100. Can you please help me.

forvalues j=1/30{
browse * if inlist(I10_DX`j', "F1110", "F11120", "F11121", "F11122", "F11129", "F1114", "F11150", "F11151", "F11159", "F11181", "F11182", "F11188 ", "F1119", "F1120", "F11220", "F11221 ", "F11222", "F11229", "F1123 ", "F1124 ", "F11250 ", "F11251", "F11259", "F11281", "F11282", "F11288", "F1129", "F1190", "F11920 ", "F11921 ", "F11922 ", "F11929 ", "F1193", "F1194 ", "F11950", "F11951 ", "F11959 ", "F11981 ", "F11982 ", "F11988 ", "F1199", "T400X1A ", "T400X1D ", "T400X2A ", "T400X2D ", "T400X3A ", "T400X3D ", "T400X4A ", "T400X4D ", "T400X5A ", "T400X5D ", "T401X1A ", "T401X1D ", "T401X2A ", "T401X2D ", "T401X3A ", "T401X3D ", "T401X4A ", "T401X4D ", "T402X1A ", "T402X1D", "T402X2A", "T402X2D ", "T402X3A ", "T402X3D ", "T402X4A ", "T402X4D ", "T402X5A ", "T402X5D", "T403X1A ", "T403X1D", "T403X2A ", "T403X2D", "T403X3A ", "T403D3D", "T403X4A ", "T403X4D", "T403X5A ", "T403X5D", "T404X1A ", "T404X1D ", "T404X2A ", "T404X2D", "T404X3A ", "T404X3D", "T404X4A ", "T404X4D", "T404X5A ", "T404X5D ", "T40601A ", "T40601D", "T40602A ", "T40602D ", "T40603A ", "T40603D ", "T40604A", "T40604D", "T40605A ", "T40605D ", "T40691A ", "T40691D", "T40692A ", "T40692D", "T40693A ", "T40693D", "T40694A ", "T40694D", "T40695A ", "T40695D")
}


ERROR:
expression too long
r(130);

Any help would be greatly appreciated,
Thanks in advance