|
|
To GENECHINA
I have read both of your program, and they are impressive because of the simplicity. But, I think you did not consider a key condistion. As in previous postings, if you delete the third data line, '1 20020102 10', you will see that the program will not generate the correct answer.
There is another comment which is also very important to all SAS programmers. As we know, the order of the records and the order of variables in a database or a data set does not make too much sense. Changing the order does not change the nature of the data. If a program depends upon the order, you had better to add BY statement for each data step. LAG and DIF functions are order dependent, you have to keep them in mind. Besides, when you do MERGE, you had better have a BY statement. MERGE without BY is very dangerous except you know exactly what are you doing.
As matter of fact, in my opinion, it is something SAS need to be modified in future. As we know, when you use FIRST.X or LAST.X, SAS will require you to have a BY statement. Same requirement should apply to LAG and DIF. |
|