全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1917 2
2010-03-09
Program:
data score;
   input Student $ StudentID $ Section $ Test1 Test2 Final;
   datalines;
Capalleti 0545 1  94 91 87
Dubose    1252 2  51 65 91
Engles    1167 1  95 97 97
Grant     1230 2  63 75 80
Krupski   2527 2  80 76 71
Lundsford 4860 1  92 40 86
McBane    0674 1  75 78 72
;
proc transpose data=score out=score_transposed;
run;


proc print data=score_transposed noobs;
    title 'Student Test Scores in Variables';
run;

Output:
                                Student Test Scores in Variables                              
                                                                   21:24 Saturday, March 9, 2002

                 _NAME_    COL1    COL2    COL3    COL4    COL5    COL6    COL7

                 Test1      94      51      95      63      80      92      75
                 Test2      91      65      97      75      76      40      78
                 Final      87      91      97      80      71      86      72

My question: Why are Char columns excluded from output???  How come only the three Num columns are transposed?

Thanks!
二维码

扫码加我 拉你入群

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

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

全部回复
2010-3-9 22:00:15
dolphinfish 发表于 2010-3-9 21:42
Program:
data score;
   input Student $ StudentID $ Section $ Test1 Test2 Final;
   datalines;
Capalleti 0545 1  94 91 87
Dubose    1252 2  51 65 91
Engles    1167 1  95 97 97
Grant     1230 2  63 75 80
Krupski   2527 2  80 76 71
Lundsford 4860 1  92 40 86
McBane    0674 1  75 78 72
;
proc transpose data=score out=score_transposed;
run;


proc print data=score_transposed noobs;
    title 'Student Test Scores in Variables';
run;

Output:
                                Student Test Scores in Variables                              
                                                                   21:24 Saturday, March 9, 2002

                 _NAME_    COL1    COL2    COL3    COL4    COL5    COL6    COL7

                 Test1      94      51      95      63      80      92      75
                 Test2      91      65      97      75      76      40      78
                 Final      87      91      97      80      71      86      72

My question: Why are Char columns excluded from output???  How come only the three Num columns are transposed?

Thanks!
The two questions actually are the same. If VAR statement is not specified, only those numeric variables will be transposed by SAS default.
二维码

扫码加我 拉你入群

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

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

2010-3-10 09:15:19
进来温故而知新
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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