Hello,
I run the following code and in the result dataset baselineT1 I got the same value 2000 in each record under newfield ...…regardless of the multiple conditions below.
Surv_new is numeric data type .
Newfield is a character data type.
I have beaten my head but I do not have any idea why I get the same value. Any help would be greatly appreciated
data baselineT1;
set baselineT;
length newfield $6;
If 01/01/00 le surv_new le 12/31/00 then newfield ='2000 ';
Else if 01/01/01 le surv_new le 30/06/01 then newfield ='2001_1';
Else if 01/07/01 le surv_new le 12/31/01 then newfield ='2001_2';
Else if 01/01/02 le surv_new le 06/30/02 then newfield ='2002_1';
Else if 01/07/02 le surv_new le 12/31/02 then newfield ='2002_2';
Else if 01/01/03 le surv_new le 06/30/03 then newfield ='2003_1';
Else if 07/01/03 le surv_new le 12/31/03 then newfield ='2003_2';
Else if 01/01/04 le surv_new le 06/30/04 then newfield ='2004_1';
Else if 07/01/04 le surv_new le 12/31/04 then newfield ='2004_2';
Else if 01/01/05 le surv_new le 06/30/05 then newfield ='2005_1';
Else if 07/01/05 le surv_new le 12/31/05 then newfield ='2005_2';
run;
I run the following code and in the result dataset baselineT1 I got the same value 2000 in each record under newfield ...…regardless of the multiple conditions below.
Surv_new is numeric data type .
Newfield is a character data type.
I have beaten my head but I do not have any idea why I get the same value. Any help would be greatly appreciated
data baselineT1;
set baselineT;
length newfield $6;
If 01/01/00 le surv_new le 12/31/00 then newfield ='2000 ';
Else if 01/01/01 le surv_new le 30/06/01 then newfield ='2001_1';
Else if 01/07/01 le surv_new le 12/31/01 then newfield ='2001_2';
Else if 01/01/02 le surv_new le 06/30/02 then newfield ='2002_1';
Else if 01/07/02 le surv_new le 12/31/02 then newfield ='2002_2';
Else if 01/01/03 le surv_new le 06/30/03 then newfield ='2003_1';
Else if 07/01/03 le surv_new le 12/31/03 then newfield ='2003_2';
Else if 01/01/04 le surv_new le 06/30/04 then newfield ='2004_1';
Else if 07/01/04 le surv_new le 12/31/04 then newfield ='2004_2';
Else if 01/01/05 le surv_new le 06/30/05 then newfield ='2005_1';
Else if 07/01/05 le surv_new le 12/31/05 then newfield ='2005_2';
run;