SAS 无法加载过程格式
SAS Could Not Load Proc Format
我正在尝试创建一种 proc 格式,该格式读取邮政编码并相应地将标签应用于其状态。
出于某种原因,尽管我的开始和结束字段都是数字,但它一直返回一条错误消息:
"The format ZONENEW was not found or could not be loaded."
我想到的唯一解决方法是将我的 Pcode 数据更改为文本,并将我的开始和结束格式字段也更改为文本。
这是我现有的代码,仍然是数字格式。
data Fmt_All_zones;
set all_zones end=eof;
retain type 'c';
fmtname = 'zonenew';
start = pcode_fr;
end = pcode_to;
label = key;
output;
if eof then do;
start = 'other';
end = 'other';
label = "Error";
output;
end;
run;
proc format cntlin = fmt_all_zones library = work;
run;
data TestPostcodes;
input Pcode;
datalines;
2050
2065
3000
2879
9999
1999
6488
;
run;
data FilteredPcode;
set TestPostcodes;
Pcode_Label = put(Pcode, zonenew.);
run;
我希望得到解释,以帮助我从概念上理解该过程!谢谢
您通过设置 TYPE='C'
定义了字符格式。如果您想要数字格式,请使用 TYPE='N'
.
我正在尝试创建一种 proc 格式,该格式读取邮政编码并相应地将标签应用于其状态。
出于某种原因,尽管我的开始和结束字段都是数字,但它一直返回一条错误消息:
"The format ZONENEW was not found or could not be loaded."
我想到的唯一解决方法是将我的 Pcode 数据更改为文本,并将我的开始和结束格式字段也更改为文本。
这是我现有的代码,仍然是数字格式。
data Fmt_All_zones;
set all_zones end=eof;
retain type 'c';
fmtname = 'zonenew';
start = pcode_fr;
end = pcode_to;
label = key;
output;
if eof then do;
start = 'other';
end = 'other';
label = "Error";
output;
end;
run;
proc format cntlin = fmt_all_zones library = work;
run;
data TestPostcodes;
input Pcode;
datalines;
2050
2065
3000
2879
9999
1999
6488
;
run;
data FilteredPcode;
set TestPostcodes;
Pcode_Label = put(Pcode, zonenew.);
run;
我希望得到解释,以帮助我从概念上理解该过程!谢谢
您通过设置 TYPE='C'
定义了字符格式。如果您想要数字格式,请使用 TYPE='N'
.