我是 SAS 新手,在创建以下程序时遇到了一些困难。
我的要求是传递动态生成的文件名并读取它,这样就不必编写五次代码来从 5 个不同的文件中读取数据,然后在数据集上运行频率。
我提供了下面的代码,并且必须为 50 多个文件编写此代码:
代码
filename inp1 '/chshttp/prod/clients/coms/raw/coms_coms_relg_f1102_t1102_c10216_vEL5535.raw';
filename inp2 '/chshttp/prod/clients/coms/raw/coms_coms_relg_f1103_t1103_c10317_vEL8312.raw';
filename inp3 '/chshttp/prod/clients/coms/raw/coms_coms_relg_f1104_t1104_c10420_vEL11614.raw';
filename inp4 '/chshttp/prod/clients/coms/raw/coms_coms_relg_f1105_t1105_c10510_vEL13913.raw';
filename inp5 '/chshttp/prod/clients/coms/raw/coms_coms_relg_f1106_t1106_c10628_vEL17663.raw';
data test;
Do i = 1 to 5;
infile_name = 'inp' || i;
infile infile_name recfm = v lrecl=1800 end=eof truncover;
INPUT
@1 E_CUSTDEF1_CLIENT_ID $CHAR5.
@1235 E_MED_PLAN_CODE $CHAR20.
@1090 MED_INS_ELIG_COVERAGE_IND $CHAR20.
@1064 MED_COVERAGE_BEGIN_DATE $CHAR8.
@1072 MED_COVERAGE_TERM_DATE $CHAR8.
;
if E_CUSTDEF1_CLIENT_ID ='00002' then
output test;
end;
run;
proc freq data = test;
tables E_CUSTDEF1_CLIENT_ID*E_MED_PLAN_CODE / list missing;
run;
请帮忙!!