全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1626 1
2007-09-09
name birthday gender which race time
Smith, James 03-09-91 M 1 00:39:42
Smith, James 03-09-91 M 2 00:38:25
Anderson, Jim 05-27-79 M 1 00:36:10
Anderson, Jim 05-27-79 M 2 00:36:52
Milton, Karen 10-23-71 F 1 00:42:36
Milton, Karen 10-23-71 F 2 00:44:01
Cooper, Frances 02-13-82 F 1 00:46:47
(这个数据只是一部分)
就是说有两个比赛,有的人参加一次,也参加了另一次,还给出了每次所用的时间。
现在要求:
restructure the data set so there is only observation per runner with the
observation giving the name of the runner ,their sex ,age ,age group (Youth,
adult ,or Senior),the times for the two races and the best time.Print(
display)this new data set.
Female Youth(16 and under) Female Adult(17-49) Female Senior (50 and over) -
----

都快崩溃了,周围没有人够请教的的,只能上来问了。
1.知道了生日怎末求年龄呢?是不是只有知道了年龄才能用它给出的条件来分组呢?
2.还有就是一个名字出现两次怎样变成他只出现一次呢?
还不知道学的啥呢,就要考试了,谢谢大家指点.

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2007-9-9 23:35:00
proc sort data =work; by name gender birthday;
proc transpose data = work out=work2;
by name gender birthday ;
id which_race;
var time;
run;
data work3( rename = ( _1 = race1 _2 = race2));
set work2;
age = year(today()) - year(birthday);
if age le 16 then age_group = '16 and under';
else if age le 49 then age_group = '17-49';
else age_group = '50 and over';
bestTime = min(_1, _2);
run;
proc print data =work3;
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群