I have two datasets. One has clean variable text another has uncleaned with page numbers. I want to identify clean text into uncleaned text, like find function in data step. is there any solution?
I have tried below code it is not searching like index/find in data step.
P.S: I do not have any common variable to merge in datastep. I choose hash table to find page numbers from another dataset. I can not use Perl regular expression since variable acrf is unstructured.
data final;
if _n_ eq 1 then do;
if 0 then set acrftxt;
dcl hash h(dataset:'acrftxt');
h.definekey('acrf');
h.definedata('pages');
h.definedone();
end;
set gdb;
if h.find(key: question) eq 0 then page=pages;
run;
acrftxt dataset eg
data ACRFTXT; infile datalines dsd truncover; input acrf:$32767. pages:$12.; datalines4; 19. Preferred Term Code [hidden],1 [Preferred Term Code],1 20. High Level Term Code [hidden],1 ,2 [High Level Term Code],2 ,2 21.,2 ,2 High Level Group Term Code [hidden],2 ,2 [High Level Group Term Code],2 ,2 22.,2 ,2 Body System or Organ Class Code [hidden],2 1.,4 2.,4 3.,4 4.,4 5.,4 6.,4 7.,4 ,4 ,4 Microbiology Subcategory,4 ,4 [Microbiology Subcategory],4 ,4 Specimen Type,4 ,4 [Specimen Type],4 ,4 What was the site of specimen?,4 ,4 [Site of Specimen],4 9.,4 10.,4 11.,4 12.,4 13.,4 14.,4 ,4 ,4 D,4 ,4 ,4 Were any isolates obtained from this specimen?,4 ,4 "If a Gram-positive pathogen was cultured, is it vancomycin-susceptible?(only applies to Enterococcus, Pediococcus, Lactobacillus or Leuconostoc) [hidden]",4 ,4 "If the pathogen cultured is Staphylococcus aureus, is it oxacillin-susceptible? (methicillin-susceptible) [hidden]",4 ,4 [Oxacillin-susceptible],5 ,5 "If a Gram-negative pathogen was cultured, is it aztreonam susceptible? [hidden]",5 ,5 Organism Genus/Species,5 ,5 Entry,5 ,5 Organism Genus/Species,5 ,5 [Organism Genus/Species],5 ;;;; run;
gdb dataset eg
data GDB; infile datalines dsd truncover; input question:$200.; datalines4; Preferred Term Code [hidden] High Level Term Code [hidden] High Level Group Term Code [hidden] Body System or Organ Class Code [hidden] Microbiology Subcategory What was the site of specimen? Specimen Type "If a Gram-positive pathogen was cultured, is it vancomycin-susceptible?(only applies to Enterococcus, Pediococcus, Lactobacillus or Leuconostoc) [hidden]" Were any isolates obtained from this specimen? Organism Genus/Species "If the pathogen cultured is Staphylococcus aureus, is it oxacillin-susceptible? (methicillin-susceptible) [hidden]" "If a Gram-negative pathogen was cultured, is it aztreonam susceptible? [hidden]" ;;;; run;
... View more