作者AmigoSafin ()
看板Statistics
标题[程式] SAS 读入资料请教
时间Thu Jun 13 11:48:06 2019
TITLE请注名软体类别 如[程式] stata
发文前请把灰色的注解删除(可使用ctrl+y删除一整行)
[软体程式类别]:
请填入软体程式类别,例如:SAS、SPSS、AMOS、R、STATA、EVIEWS...等
SAS
[程式问题]:
资料处理、回归、叙述统计、logistic、probit...等
资料处理
[软体熟悉度]:
请把以下不需要的部份删除
熟悉
但有点久没用了
[问题叙述]:
读入看似是fixed width data但应该要用mixed input
[程式范例]:
White Male R V 116
White Male R NoV 324
White Male NoR V 54
White Male NoR NoV 106
White Female R V 16
White Female R NoV 104
White Female NoR V 24
White Female NoR NoV 156
Black Male R V 2
Black Male R NoV 18
Black Male NoR V 8
Black Male NoR NoV 72
Black Female R V 162
Black Female R NoV 18
Black Female NoR V 18
Black Female NoR NoV 2
Data长得如上
我用的code:
data num1;
input race $1-6 gender $7-12 @13 percep $15-17 Vac $19-22 count COMMA3.;
cards;
White Male R V 116
White Male R NoV 324
White Male NoR V 54
White Male NoR NoV 106
White Female R V 16
White Female R NoV 104
White Female NoR V 24
White Female NoR NoV 156
Black Male R V 2
Black Male R NoV 18
Black Male NoR V 8
Black Male NoR NoV 72
Black Female R V 162
Black Female R NoV 18
Black Female NoR V 18
Black Female NoR NoV 2
;
run;
proc print; run;
但gender那边male後面就会把下一栏位的资料也读进来
有点苦恼 还请大家指点
谢谢了!!
感恩
--
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 68.180.87.229 (美国)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Statistics/M.1560397689.A.AFE.html
1F:→ Neroth: 改成input race $ gender $ percep $ Vac $ count; 试试? 06/13 20:43
2F:→ holmespei: 你应该是栏位值数错 06/13 23:00
3F:→ AmigoSafin: 以解决 感谢大家 我就把名称改改让他可output LOL 06/17 07:09