|
我理解问题2和3好象应该是这样
/* code for Question 2 and 3 */
/* import the data */
PROC IMPORT OUT= WORK.yyy
DATAFILE= "F:\MySAS\080719-20-2002-2004.csv"
DBMS=CSV REPLACE;
GETNAMES=YES;
DATAROW=2;
RUN;
/* select the number of variables */
%let nvar=%sysfunc(attrn(%sysfunc(open(work.yyy,i)),nvars));
/* remove the empty row and fill the missing */
data zzz;
length Country_by_Commodity___Imports $60;
length var2 $26;
array v{*} $40 var3-var&nvar;
set yyy;
miss=0;
retain temp;
if not missing(Country_by_Commodity___Imports) then temp = Country_by_Commodity___Imports;
else Country_by_Commodity___Imports=temp;
do i = 1 to dim(v);
if not missing(v(i)) then miss+1;
end;
if miss < 1 and _n_ ^=1 then delete; /* remove _n_^=1 if don't want the first row */
drop miss i temp;
run;
proc print data=zzz; title 'zzz'; run;
|