|
板凳

楼主 |
发表于 2012-6-11 21:45:44
|
只看该作者
Re: 求助:sas如何生成汉字的拼音?
[code:o0t17726]
data a;
input x $;
u=substr(x,1,2);
v=substr(x,3,2);
ith=_n_;
cards;
陈三
李四
王五
;
run;
data uds;
set a;
keep ith u;
run;
data vds;
set a;
keep ith v;
run;
data b;
input char $ pinyin $;
cards;
陈 chen
三 san
李 li
四 si
王 wang
五 wu
;
proc sql noprint;
create table c as
select uds.ith, uds.u, b.pinyin
from uds,b
where uds.u=b.char;
quit;
proc sql noprint;
create table d as
select vds.ith, vds.v, b.pinyin
from vds,b
where vds.v=b.char;
quit;
proc sql noprint;
create table e as
select strip(c.u)||strip(d.v) as x,strip(c.pinyin)||strip(d.pinyin) as py
from c,d
where c.ith=d.ith;
quit;
[/code:o0t17726]
上述程序是非智能的,就是不能自动根据观测的大小匹配注音。
在测试智能程序时,遇到如下问题,请高手指点,我的想法是把变量的观测值,拆成一个一个的汉字,然后在字典中查找。查找程序已经写好,但是被卡在了自动拆分这个环节,
如下程序,shixing ba di yi ge ji fu zhi gei bian liang x1, dan shi mei you chneg gong
[code:o0t17726]
%let ch=陈三;
data m;
x1=substr(&ch,1,2);
run;
[/code:o0t17726] |
|