[程式] sas 大小寫問題

看板Statistics作者 (蓉)時間14年前 (2011/03/25 01:55), 編輯推噓2(202)
留言4則, 2人參與, 最新討論串1/1
[軟體程式類別]: 請填入軟體程式類別 例如SAS、SPSS、R、EVIEWS...等 sas [程式問題]: 資料處理、迴歸、敘述統計、logistic、probit...等 資料處理 [軟體熟悉度]: 請把以下不需要的部份刪除 新手(不到1個月) [問題敘述]: 我在用merge要併資料的時候 發現有大小寫區分的問題 請問要怎麼樣把我sas檔案裡面的內容小寫改成大寫呢?(大小寫轉換) 或是當sas在合併資料的時候,有沒有指令可以叫它" W "和" w "視為同一個呢? 我有查了一下google 大多數都說是寫程式的code不用區分大小寫 但是還是無解 感謝各位!!! [程式範例]: 我現在主要目的是要併公司名稱 資料呈現的方式如下 first5是指該間公司第一個字的前五個字母,second5指第二個字的前五個字母 檔案cust cname first5 second5 Wal-mart Store Inc. Wal-m Store WAL-MART STORE INC. WAL-M STORE wal-mart store wal-m store 檔案fight CONML first5 second5 conm comnam Wal-mart Store Inc. Wal-m Store WAL-MART STORE INC. wal-mart store 最後跑出來的結果是 cname first5 second5 CONML conm comnam Wal-mart Store Inc. Wal-m Store Wal-mart Store Inc. WAL-MART wal-mart WAL-MART STORE INC. WAL-M STORE wal-mart store wal-m store 就是下面這二個(大小寫不同)不會對到 程式碼如下: data customer.fight; set customer.fight; first5=substr(scan(CONML,1,' '),1,5); second5=substr(scan(CONML,2,' '),1,5);run; data customer.cust; set customer.cust; first5=substr(scan(Cname,1,' '),1,5); second5=substr(scan(Cname,2,' '),1,5); Proc sort data=customer.fight ; by FIRST5 second5; Proc sort data=customer.cust; by FIRST5 second5; data customer.profs5merge; merge customer.cust customer.fight;by first5 second5;run; ----------------------------------------------------------------------------- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 115.80.146.164

03/25 02:39, , 1F
upcase()小寫轉大寫 lowcase()大寫轉小寫
03/25 02:39, 1F

03/25 02:42, , 2F
寫程式大小寫不分的意思是只寫程式碼時大小寫沒差,資料
03/25 02:42, 2F

03/25 02:42, , 3F
裡的大小寫就一定會有差了
03/25 02:42, 3F

03/25 10:47, , 4F
用function囉! 即樓上w大提到的function
03/25 10:47, 4F
文章代碼(AID): #1DYuMdpG (Statistics)