data _null_; /* Iterate over all the files input */ infile '\json_test\MyDrug*.json' end=eof; /* Open the file to write the output to */ file '\MyDrug_all.json'; /* Read a line of input */ input; /* If this is the first line in the file print it to the output file verbatim */ if _n_ = 1 then put _infile_; /* If this is the last line print it out verbatim */ else if eof then put _infile_; /* Otherwise we are in the middle somewhere */ else do /* Check what the first character of the line is */ /* Its either [, ], or , */ first_character = substr(_infile_,1,1); select (first_character); /* If its [ we must remove it */ when ("[") do; line_without_first_character = substr(_infile_,2); put line_without_first_character; end; /* If its ] we must swap it to a , to allow more objects in the array */ when ("]") put "," @@; otherwise put _infile_; end; end; run;
... View more