我有一个包含两个格式化变量的数据集,一个是原始代码(代表一个国家/地区的名称),另一个是将该代码转换为国家/地区的标准化代码。这两种格式都使用显示国家名称的格式。
我想输出格式化值不同的值,而不考虑真实值。例如,如果我有以下数据(方括号中显示的格式):
obs Country_raw[formatted value] Country_std[formatted value]
1 2211[Spain] 3108[Spain]
2 9122[Zaire] 9108[Democratic Republic of Congo]
对于这两条记录,两个真实值都不匹配,但我只想输出第二条记录,其中格式化值不匹配。
我试过了
data diffs;
set countries;
format country_raw $CRAW.;
format country_std $CSACC.;
if country_raw ne country_std THEN OUTPUT;
run;
但这使用了真实值。
我也尝试过使用 proc print:
proc print data=countries;
format country_raw $CRAW.;
format country_std $CSACC.;
where country_raw ne country_std;
run;
但这也适用于真实值。