|
Files are managed by operating system and various operating systems have different kinds of files. Using the INFILE statement, which is used to identify an input text file, you can read multiple VSAM files in one DATA step. The RETAIN statement sets the values of FILE variable before each observation. The SELECT block will execute the INFILE statement, INPUT statement, IF condition statement and output/create SAS datasets (DXRECS and MASTERRECS). Then it goes back to the top of the observation loop. The INFILE option EOF= indicates to read the next INFILE statement when it reaches the end of a file. The STOP statement is used conditionally to stop the observation loop after a certain condition is met.
Note: This is conceptually an example code for MVS OS/390. There's no need to allocate DD statement in your JCL.
|
data DXRECS
MASTERRECS;
retain file 1;
top: select (file);
when (1) infile 'TESTS.DSN.DIAGNOSIS.MAPPING' eof=next;
when (2) infile 'TESTS.DSN.MASTER.RECORDS' eof=next;
otherwise stop;
end;
drop file;
select (file);
when (1) do;
input
@1 Form $charzb5.
@6 SubSequence $charzb2.
@8 TargetReference $charzb4.
@35 ICD9Code $charzb5.
@;
if substr(form,3,3)='052'
then output DXRECS;
end;
when (2) do;
input
@1 SectionSequence $charzb2.
@3 SubSequence $charzb2.
@5 TargetReference $charzb4.
@14 Descriptor $charzb40.
@;
if (sectionsequence='02')
and ('12'<=subsequence<='24')
then output MASTERRECS;
end;
otherwise;
end;
return;
next: file+1;
go to top;
run;
|
|