hello dear SAS experts,
I often have to add new lines such as the following ones to an existing dataset that has the same structure. I use the following code. The dataset Filialstruktur1 is completed by the dataset Filialstruktur_Ergaenzung.
From time to time, I have to add new datalines to the Filialstruktur_Ergaenzung dataset.
A dataline is based on 2 parameters for example here 91100 and 'FIL1':
MARKTREGION_BT = 'FIL1' ; NLHB_BT = 91100 ; NLBEZ_BT = 'FIL1' ; MBRHB_BT = 91100 ; MBRBEZ_BT_DASHB = 'FIL1' ; FILHB_BT = 91100 ; FILBEZ_BT_DASHB = 'FIL1' ; FILHB_BT_EC = '91100' ; output;
My question: how can I do better?
proc sort data=Filialstruktur1; by filhb_bt;run;
data Filialstruktur_Ergaenzung ;
length MARKTREGION_BT $35 NLHB_BT $5 NLBEZ_BT $35 MBRHB_BT $5 MBRBEZ_BT_DASHB $40 FILHB_BT $5 FILBEZ_BT_DASHB $40 ;
MARKTREGION_BT = 'FIL1' ; NLHB_BT = 91100 ; NLBEZ_BT = 'FIL1' ; MBRHB_BT = 91100 ; MBRBEZ_BT_DASHB = 'FIL1' ; FILHB_BT = 91100 ; FILBEZ_BT_DASHB = 'FIL1' ; FILHB_BT_EC = '91100' ; output;
MARKTREGION_BT = 'Vermittler' ; NLHB_BT = 99991 ; NLBEZ_BT = 'Vermittler' ; MBRHB_BT = 99991 ; MBRBEZ_BT_DASHB = 'Vermittler' ; FILHB_BT = 99991 ; FILBEZ_BT_DASHB = 'Vermittler' ; FILHB_BT_EC = '99991' ; output;
MARKTREGION_BT = 'FIL2' ; NLHB_BT = 99993 ; NLBEZ_BT = 'FIL2' ; MBRHB_BT = 99993 ; MBRBEZ_BT_DASHB = 'FIL2' ; FILHB_BT = 99993 ; FILBEZ_BT_DASHB = 'FIL2' ; FILHB_BT_EC = '99993' ; output;
MARKTREGION_BT = 'Online' ; NLHB_BT = 99992 ; NLBEZ_BT = 'Online' ; MBRHB_BT = 99992 ; MBRBEZ_BT_DASHB = 'Online' ; FILHB_BT = 99992 ; FILBEZ_BT_DASHB = 'Online' ; FILHB_BT_EC = '99992' ; output;
MARKTREGION_BT = 'FIL3' ; NLHB_BT = 99994 ; NLBEZ_BT = 'FIL3' ; MBRHB_BT = 99994 ; MBRBEZ_BT_DASHB = 'FIL3' ; FILHB_BT = 99994 ; FILBEZ_BT_DASHB = 'FIL3' ; FILHB_BT_EC = '99994' ; output;
MARKTREGION_BT = 'FIL4' ; NLHB_BT = 99995 ; NLBEZ_BT = 'FIL4' ; MBRHB_BT = 99995 ; MBRBEZ_BT_DASHB = 'FIL4' ; FILHB_BT = 99995 ; FILBEZ_BT_DASHB = 'FIL4' ; FILHB_BT_EC = '99995' ; output;
MARKTREGION_BT = 'Nicht_zustellbar' ; NLHB_BT = 99999 ; NLBEZ_BT = 'Nicht_zustellbar' ; MBRHB_BT = 99999 ; MBRBEZ_BT_DASHB = 'MBR Nicht zustellbar' ; FILHB_BT = 99999 ; FILBEZ_BT_DASHB = 'Nicht_zustellbar' ; FILHB_BT_EC = '99999' ; output;
run;
data Filialstruktur_Ergaenzt;
set Filialstruktur1 Filialstruktur_Ergaenzung;
run;