I have a unique requriment. I have 4 SAS datasets in sas library (p4,A,B,C). I have to read 1 observation from A,do some processing , store in temp dataset. Read 1 observation from B,do some process and store in temp dataset. Read 1 observation from C and do some processing and store in temp dataset. Then write all the temp dataset in JSON format. I am using multiple data steps and PROC JSON. It is taking lot of 'wall clock ' unusually. below is the sample code. Is there any way better to do this to avoid program load delay and voluntary wait. LIBNAME JSON 'JSON';
%DO I = &fstobs %to &COUNT;
data a1;
set JSON.policy4(FIRSTOBS=&I OBS=&I);
call symput('policy_no',policyNumber);
run;
data aa;
set JSON.A;
if policy > &policy_no then DO; STOP; END;
else if policy = &policy_no then do;
N + 1;drop N;
id = cats('&policy_id',_N_);
output; end;
run;
data bb;
set JSON.b;
if policy > &policy_no then DO; STOP; END;
else if policy = &policy_no then do;
N + 1;drop N;
id = cats('&policy_id',_N_);
output; end;
run;
data cc;
set json.c3;
if policyNumber > &policy_no then DO; STOP; END;
else if policyNumber = &policy_no then do;
N + 1;drop N;
id = cats('&policy_id',_N_);
output; end;
run;
%macro output_json(table1,table2,table3,table4);
PROC JSON OUT= dat3
NOPRETTY NOSASTAGS FMTDATETIME FMTNUMERIC;
write open object;
write values 'kkkkkk';
EXPORT &table1;
write values 'jjjjjj';
write open array;
EXPORT &table2;
write close;
write values 'xxxxx ';
write open array;
EXPORT &table3;
write close;
write values 'yyyyyy';
write open array;
EXPORT &table4;
write close;
SAS LOG FIRST POLICY or FIRST OBSERVATION ( for 1000 obesrvations it is taking ~10 minutes). We have to do this for more than 1Bn. NOTE: There were 9 observations read from the data set PHOENIX.POLCOMP3. NOTE: The data set WORK.PCOMP1 has 8 observations and 25 variables. NOTE: The DATA statement used the following resources: CPU time - 00:00:00.00 Elapsed time - 00:00:00.03 EXCP count - 94 Task memory - 5291K (156K data, 5135K program) Total memory - 29582K (7840K data, 21742K program) Timestamp - 10/11/2020 10:51:06 PM NOTE: The address space has used a maximum of 924K below the line and 37904K abo NOTE: There were 9 observations read from the data set PHOENIX.AGENT3. NOTE: The data set WORK.AGENT has 8 observations and 36 variables. NOTE: The DATA statement used the following resources: CPU time - 00:00:00.00 Elapsed time - 00:00:00.02 EXCP count - 95 Task memory - 5296K (161K data, 5135K program) Total memory - 29582K (7840K data, 21742K program) Timestamp - 10/11/2020 10:51:06 PM NOTE: The address space has used a maximum of 924K below the line and 37904K abo NOTE: There were 30 observations read from the data set PHOENIX.CPYMENT3. NOTE: The data set WORK.CPAYMNT has 29 observations and 19 variables. NOTE: The DATA statement used the following resources: CPU time - 00:00:00.00 Elapsed time - 00:00:00.03 EXCP count - 94 Task memory - 5291K (156K data, 5135K program) Total memory - 29582K (7840K data, 21742K program) Timestamp - 10/11/2020 10:51:06 PM NOTE: The address space has used a maximum of 924K below the line and 37904K abo NOTE: The PROCEDURE JSON used the following resources: 6 The SAS System CPU time - 00:00:00.00
Elapsed time - 00:00:00.01
EXCP count - 21
Task memory - 3800K (91K data, 3709K program)
Total memory - 29648K (7840K data, 21808K program)
Timestamp - 10/11/2020 10:51:06 PM NOTE: The address space has used a maximum of 924K below the line and 37904K abo
... View more