Hi, here's another idea. First data step creates a data set with one variable that might contain one or more ASCII characters with a value of more than 127. Next data step checks the length of the string to the length after removibg all characters ASCII value 128+. data have; length x $10; do i=1 to 20; x=' '; do j=1 to 10; y = ceil(100*ranuni(99)) + 32; x = catt(x,byte(y)); end; output; end; keep x; run; * check for characters with ASCII value 128+ ... OK = 1 means there are none; data want; set have; ok = length(x) eq length(compress(x,collate(128,255))); run; data set WANT ... Obs x ok 1 @$[e8€l`}\ 0 2 ,wQbkKƒ?fK 0 3 .w>L+brMdA 1 4 +04ƒFKhn<a 0 5 Q8[U/?{K_y 1 6 Lt(Bzl{+Wy 1 7 h„9Zm0kZ7C 0 8 _xb+RLpa_k 1 9 4C6Qs&M^#] 1 10 q3$ypchlqC 1 11 4SrN>?Xspa 1 12 jvr|1_X}fT 1 13 {1|Q}DWQ0i 1 14 ~f]>Yjz7Gm 1 15 86K08O*€g1 0 16 H/sE6ITbSi 1 17 +b_8J5I?=v 1 18 O4~vtC3ZPw 1 19 MFr€-CuAeI 0 20 h„D24xiM}i 0 If you want the data step to just stop when characters 128+ are encountered, you could just use ... if length(x) ne length(compress(x,collate(128,255))) then stop; If you are reading raw data rather than a data set, you could use ... data want; infile 'z:\ascii.txt'; input; if length(_infile_) ne length(compress(_infile_,collate(128,255))) then stop; run;
... View more