I used the following code. proc sql;
create table fault_CNT_only as
select Unit, fault_code, count(*) as fault_count
from all_units_results
group by Unit, fault_code;
quit;
proc sql;
create table fault_CNT as
select A.Unit, A.fault_code, count(*) as fault_count,
B.sw_install_date
from all_units_results A left join InstallDate B
on A.Unit=B.vehicle_no
group by Unit, fault_code
;
quit; The output of fault_CNT_only looks like: 8116 20-1803 1 8118 20-0715 1 8119 20-1801 2 8119 20-1802 2 8119 20-1803 2 8119 20-1804 3 8119 20-1806 2 8133 20-0794 1 while the output of fault_CNT looks like: 8116 20-1803 1 02JAN2015 8118 20-0715 1 01JAN2015 8119 20-1801 2 01JAN2015 8119 20-1801 2 01JAN2015 8119 20-1802 2 01JAN2015 8119 20-1802 2 01JAN2015 8119 20-1803 2 01JAN2015 8119 20-1803 2 01JAN2015 8119 20-1804 3 01JAN2015 8119 20-1804 3 01JAN2015 8119 20-1804 3 01JAN2015 8119 20-1806 2 01JAN2015 8119 20-1806 2 01JAN2015 8133 20-0794 1 01JAN2015 How can I get the same number of rows for fault_CNT as in fault_CNT_only? Thanks for your help.
... View more