data lab;
infile datalines truncover ;
input LABORATORY_INFORMATION $32767.;
datalines;
<b>Local ID:</b> OBS456571123N01<b><b>Date Received by PH:</b> 01/15/2020<b><b>Specimen Collection Date:</b> 01/06/2020<b><b>ELR Indicator:</b>Y<b><b>Resulted Test:</b> RPR Qualitative Stat<b><b>Coded Result:</b> <b><b>Numeric Result:</b> <b><b>Text Result:</b> Reactive *<b><b>Comments:</b> <b><b><b>Local ID:</b> OBS45657123IN01<b><b>Date Received by PH:</b> 01/15/2020<b><b>Specimen Collection Date:</b> 01/07/2020<b><b>ELR Indicator:</b>Y<b><b>Resulted Test:</b> RPR Quantitative Stat<b><b>Coded Result:</b> <b><b>Numeric Result:</b> <b><b>Text Result:</b> 1:64<b><b>Comments:</b> <b><b><b>Local ID:</b> OB456874123N01<b><b>Date Received by PH:</b> 03/13/2020<b><b>Specimen Collection Date:</b> 01/05/2020<b><b>ELR Indicator:</b>Y<b><b>Resulted Test:</b> FTA<b><b>Coded Result:</b> <b><b>Numeric Result:</b> <b><b>Text Result:</b> Reactive *<b><b>Comments:</b> <b><b>
;
run;
data lab2;
set lab;
array columns [9] $200 localid datercdbyph speccolldt elr_ind resultedtest codedresult numericresult textresults comments;
loop:
start=1;
do index=1 to 9;
temp1 = find(laboratory_information, "</b>", start);
temp2 = find(laboratory_information, "<b>", temp1);
columns[index] = substr(laboratory_information, temp1 + 4, temp2 - temp1 - 4);
start=temp2;
end;
output;
call missing(of columns[*]);
if length(laboratory_information) > (start + 6) then do;
laboratory_information = substr(laboratory_information, start + 6);
goto loop;
end;
run;
Appologies, I didnt realise it was one row. How about this?
... View more