看板 Statistics 關於我們 聯絡資訊
有更簡單的方法 proc sort data=temp1;by name; run; data a; set temp1; retain place; if name^=lag(name) then place=sum(place,1); run; 這樣很快就可以將你的地名數字化 data place; set temp1; if name^=lag(name) then output; keep name place; run; 這樣可以產生一個地名以及數字化地名的對照表 如果你要轉置 也可以用這樣來轉置 另外也可以藉由place來檢查你的地名是不是有輸入上的問題 SAS只要是文字 只要你輸入上多按一個空格鍵 或讀取上多數一格(txt) 常常會被判定是不一樣的 ※ 引述《kllin (kllin)》之銘言: : 剛才原本要改內文的 不小心就把文章砍了 @@" : 先和有推文的大大 說聲抱歉 ^^" : 我的檔案中的變項 有地名 如 台北 台中 高雄 是中文的 : 由於資料筆量大 所以不考慮以EXCEL 的取代功能更改 (XD 我也想用EXCEL改) : 我要做直橫的轉換 : PROC TRANSPOSE DATA=temp1 OUT=temp2; : BY date; : VAR abc; : ID name; : RUN; : 當中 這個name就是我的地名(中文變項) : 可是跑下去之後 : log出現紅字 : ERROR: The ID value "_j__" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "_e__" occurs twice in the same BY group. : ERROR: The ID value "___F" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "_s__" occurs twice in the same BY group. : ERROR: The ID value "_s__" occurs twice in the same BY group. : ERROR: The ID value "_s__" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "_U__" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "___s" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "_s__" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : ERROR: The ID value "____" occurs twice in the same BY group. : NOTE: The above message was for the following by-group: : DATE=01/01/1995 : ...... : ...... : ...... : 不知道是怎樣子 他看不懂中文嗎...@@" : 如果我把 ID name 的地方 name改為別的文字變項試過之後 : 又很正常 : 請問這樣如何解呀 @@" -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.225.42.79
kllin:感謝感謝 ^^" 07/07 23:53
kllin:另外 if name^=lag(name) 加了一個 ^ 是什麼意思呀... 07/07 23:56
chien533:不等於 07/08 13:38
kllin:對喔...@@" 太久沒用 我都用ne 07/08 14:43