Shmuel - your code seems like it will work for this data. I just tried modifying it a bit using my actual data (which the updated sample data it modeled off of) but now I am getting the following error: ERROR: Array subscript out of range at line 661 column 29. The line and column # change every time. Here is my adaptation of the code below: Do you see anything amiss that I am not seeing? data encounters_test; format v1-v126 ; retain i j v1-v126; length a_line word w_next $500 v1-v126 $500; infile source truncover; link read_line; array vx $ v1-v126; i=1; do until (i=127); word= scan(a_line,i,'|'); vx(i) = word; if word = '' then do; do until (a_line ne ' '); link read_line; end; if i>1 then i=i-1; do until (w_next=' '); word = scan(a_line,j,'|'); w_next = scan(a_line,j+1,'|'); vx(i) = catx(' ',vx(i),word); if w_next ne ' ' then do; i+1; j+1; end; end; end; i+1; end; output; call missing(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v80, v81, v82, v83, v84, v85, v86, v87, v88, v89, v90, v91, v92, v93, v94, v95, v96, v97, v98, v99, v100, v101, v102, v103, v104, v105, v106, v107, v108, v109, v110, v111, v112, v113, v114, v115, v116, v117, v118, v119, v120, v121, v122, v123, v124, v125, v126); keep v1-v126; return; read_line: N+1; j=1; input a_line $400.; return; run; Thanks again for your helpful response!
... View more