[程式] sas 大小寫問題
[軟體程式類別]:
請填入軟體程式類別 例如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
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
03/25 10:47, 4F