yangz98 发表于 2013-11-4 12:39
修改后有跑了几次,发现结果不对。。。
Dude, now I kind regret that I had wanted your easy bucks in the first place. Isn't God's love enough for me? Why would I want these fake Lun Tan Bi? There's something wrong in my soul. I got to quit for a few months.
- data quextion;
- infile datalines eof=last;
- input year site;
- array x[5,5] _temporary_;
- array a[5];
- site_1=lag(site);
- if _n_=1 then call pokelong(repeat(put(0,rb8.), 25), addrlong(x[1,1]), 25*8);
- else x[site_1, site] = x[site_1, site]+1;
- last:
- do i=1 to 5;
- do j=1 to 5;
- a[j] = x[i,j];
- end;
- output;
- end;
- keep a1-a5;
- cards;
- 1980 5
- 1981 1
- 1982 2
- 1983 2
- 1984 1
- 1985 2
- 1986 1
- 1987 3
- 1988 1
- 1989 3
- 1990 2
- 1991 1
- 1992 3
- 1993 3
- 1994 4
- 1995 4
- 1996 5
- 1997 5
- 1998 5
- 1999 4
- 2000 4
- 2001 1
- ;
复制代码- data quextion;
- infile datalines;
- input year site;
- cards;
- 1980 5
- 1981 1
- 1982 2
- 1983 2
- 1984 1
- 1985 2
- 1986 1
- 1987 3
- 1988 1
- 1989 3
- 1990 2
- 1991 1
- 1992 3
- 1993 3
- 1994 4
- 1995 4
- 1996 5
- 1997 5
- 1998 5
- 1999 4
- 2000 4
- 2001 1
- ;
- data q/view=q;
- set quextion;
- site_1= lag(site);
- keep site_1 site;
- proc means data=q nway noprint completetypes;
- class site_1 site;
- output out=q1;
- proc transpose data=q1 out=anxwer(drop=_name_ _label_) prefix=a;
- by site_1;
- id site;
- var _freq_;
- run;
复制代码Final word, Dywane, you're doing a heck great of job on the basketball court. I wish you success in SAS too.