w********n 发帖数: 33 | 1 ID重复的次数是不等的,time也没有规律,现已经proc sort by ID,time成以下格式:
ID time
B 04/16
B 04/23
B 04/23
G 05/02
G 05/11
G 06/01
G 06/01
H 09/01
H 10/31
H 11/23
... ...
现在要加三列虚拟的排序变量 sort1 sort2 sort3:
ID time sort1 sort2 sort3
B 04/16 1 1 1
B 04/23 1 2 2
B 04/23 1 2 3
G 05/02 2 1 1
G 05/11 2 2 2
G 06/01 2 3 3
G 06/01 2 3 4
H 09/01 3 1 1
H ... 阅读全帖 |
|
s******r 发帖数: 1524 | 2 data new;set old;by id time;
retain sort1 sort2 sort3;
if first.id then do;
sort1=max(sort1,0)+1;
sort2=1;
sort3=1;
end;
else do;
sort3=sort3+1;
if lag(time) ne time then sort2=sort2+1;
end;
run;
式: |
|
S****S 发帖数: 293 | 3 One postdoctoral scholar and one junior scientist position are available
immediately in the Division of Gastroenterology, Hepatology and Nutrition of
the Department of Medicine at the University of Minnesota, Twin Cities.
Required/Preferred Qualifications:
Ph.D. required, or M.D.
More than three years of post-graduate research experience in the fields of
liver cancer, metabolic diseases, microRNA, and RNA drug delivery.
At least one first-author publications in top-tier journals.
Skills in molec... 阅读全帖 |
|
|
|
h********o 发帖数: 103 | 6 data new;
set old;
by ID time;
if first.ID then do;
sort1 + 1;
sort2 = 1;
sort3 = 1;
end;
else do;
sort3 + 1;
if lag(time) ^= time then sort2 + 1;
end;
run; |
|