我使用 PROC FREQ 来计算所有指定的组。我不确定我的代码是否正确进入 PROC FREQ。我使用了数据,但列表看起来很乱。我创建了将所有信息分类到适当的名称组,但 PROC FREQ 的结果看起来是空的,但留下了标题并提到了 Frequency Missing=1。显然,我没有正确执行此代码。
Proc Freq 没有任何修改(但看起来很乱):
American Dialect Frequency
? 1
Creole 256
Craole 1
Californian 603
Chicano 302
Chiano 2
Chiaco 1
Midwest 423
Missing
New York City 409
NYC 35
Other 90
Pacific Northwest 128
Pittsburghese 15
Pittsburhese 2
San Francisco 78
Won't say 12
修改数据...这是我的代码:
PROC SORT data=Speechdata; by Dialect;run;
Data Speechdata2;
set= Speechdata;
If substr(Dialet,1,2)='Cr' then Dialect = 'Creole';
else if substr(Dialect,1,2)='Ca' then Dialect = 'Californian';
else if substr(Dialect,1,2)='Ch' then Dialect ='Chicano';
else if substr(Dialect,1,3)='Mid' then Dialect ='Midwest';
else if substr(Dialect,1,1)='N' then Dialect ='New York City';
else if substr(Dialect,1,2)='Sa' then Dialect ='Californian';
else if substr(Dialect,1,2)='Pi' then Dialect ='Pittsburghese';
else if substr(Dialect,1,2)='Pa' then Dialect ='Pacific Northwest';
else if substr(Dialect,1,1)='O' then Dialect ='Other';
else if substr(Dialect,1,1)='NA' then Dialect ='Missing';
else Dialect ='Missing';
run;
PROC FREQ data=Speechdata2;
table Dialect/nocum nopercent;
title 'Dialect Frequencies';
run;