Hi Alisa, I am not sure about the purpose of your code, the only hint came from the data set name 'hash_sort', so I will just assume that you want your new table sorted by 'name'. Let 's just use Ksharp's approach: data _null_ ; if _N_=1 then do; if 0 then set temp; declare hash hs(dataset:'temp', ordered:'a', multidata:'y'); hs.definekey('Name'); hs.definedata(all:'y'); hs.definedone(); end; hs.output(dataset:'hash_sort'); run; Note: 1. The dataset name 'temp' in the hash definition needs to be quoted. 2. Since key 'name' is not unique index, multidata option needs to be specified. 3. You could defined a hiter to read in the records one by one, but again, it would not be recommended. 4. since you already have 'if 0 then set', so you would not need call missing() and length statement. Regards, Haikuo
... View more