全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1614 3
2007-09-23
You have a collection of raw data representing the reading scores on three groups of subjects :control group C,method A group,method B group.The data are arranged so that a group code is followed by one or more scores for that group,and scores for any group can span more than one record of raw data.Write a SAS program that will read the data below and create a SAS data set reading with variables GROUP and SCORE,one set per obervation.
DATA TESTSCORE
C 303 102 150 B 202 C 300 B 450 400 399
420 A 289 280 278

如果只有两个变量的话,是不是结果是这样的呢:
group score
c 303
102
150
300
B 450
400
399
420
A 289
280
278
但是如何把A B C 分离出来呢
thank you
二维码

扫码加我 拉你入群

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

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

全部回复
2007-9-23 13:57:00
我全然不懂,看来要好好学习了
二维码

扫码加我 拉你入群

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

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

2007-9-24 08:38:00

One of solutions listed fellow

data testscore(DROP=X);
input x $ @@;
RETAIN G;
if x in('A','B','C') THEN DO;
G=X;
END;
ELSE DO;
V=X; OUTPUT;
END;
CARDS;
C 303 102 150 B 202 C 300 B 450 400 399
420 A 289 280 278
;
PROC SORT;
BY G;
RUN;

二维码

扫码加我 拉你入群

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

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

2007-9-24 11:49:00
非常感谢,但是有一点不是很明白,为何要把datalines放在最后呢?一般的情况下,都是datalines放在input 下边的?
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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