I'm in a mainframe environment and looking to read members of a PDS looking for certain values. The result from that are then merged with another sas dataset to create a csv file. For the most part I have something that works. My issue seems to be around when my PDS member contains more than one of that values I'm looking for, AND this PDS member has more than one entry in my sas dataset to be merged with. I'm not sure how to give a sample of my PDS within the SAS code that you could use as an example. I'll try to illustrate here what those PDS members look like – Mem01 Command, value1 Mem02 Command,value1 Command,value2 Mem03 Command,value1 This is the SAS dataset which the above gets merged with – job01 mem01 job02 mem02 job02 mem02 job03 mem02 job03 mem02 job04 mem03 So in this case I expect my output to look like – Mem01,job01,command,value1 Mem02,job02,command,value1 Mem02,job02,command,value2 Mem02,job03,command,value1 Mem02,job03,command,value2 Mem03,job04,command,value1 However what I'm seeing is this – Mem01,job01,command,value1 Mem02,job02,command,value1 Mem02,job02,command,value2 Mem02,job03,command,value2 Mem02,job03,command,value2 Mem03,job04,command,value1 For members with multiple commands, that are associated to multiple jobs, it seems the value retains the setting of the last occurrence from the first job. In this case, the first occurrence of mem02,job03,command,value2 should reflect value1, not value2. This is what my code looks like: data have;
infile cards missover;
input job $ 02-09
member $ 11-18
;
cards;
job01 mem01
job02 mem02
job02 mem02
job03 mem02
job03 mem02
job04 mem03
;
run;
proc sort data=have
OUT=have_NoDups
nodupkey ;
by member ;
run ;
data file2;
set have_NoDups;
infile 'aaaa.bbbbbb.cccc.pds' memvar=member end=done;
do until (done);
input msg $ 01-72 ;
if msg =: 'COMMAND' or msg =: 'FRED' then do;
parm1 = scan(msg,1,",") ;
parm2 = scan(msg,2,",") ;
memnam = member ;
output;
drop msg;
end;
end;
run;
/*********************************************************************/
/* Merge the jobs file with the commands file */
/*********************************************************************/
DATA file3;
Merge have file2 (rename=(memnam=member));;
by member;
proc print;
run;
Any thoughts as to what I'm missing here? Hope that makes sense.
... View more