b******e 发帖数: 23 | 1 需要sort一个sas dataset 的 date变量:
变量的格式是
09-Aug.-2009
11-Apr.-2009
...
直接用by...不好用(因为是character?初用sas没经验)
请问应该怎么format这个变量,然后sort呢?
能给个statement就感激了。
谢谢!! |
l*********s 发帖数: 5409 | 2 are you sure it is chacter? if so, you need to convert it to numeric data
variable first then do sorting as usual. |
b******e 发帖数: 23 | 3 the format of this variable at dataset label is 'date'. but, i do not know
how to convert it to numeric data variable. :-( |
b******e 发帖数: 23 | |
s***r 发帖数: 1121 | 5 first use substr function to get MM DD YY; then use MDY function to get
numeric value of your data; finally sort. |
w*******t 发帖数: 928 | 6 data one;
infile cards;
input date $1-12;
format date1 mmddyy10.;
date1=input(compress(date,' .'), date11.);
cards;
09-Aug.-2009
11-Apr.-2009
;
run;
proc sort data=one; by date1; run; |