作者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/m.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