Hi, if you do not have a lot of variables .
[pre]
%let default_values=-999,-998,-997,999;
Data X;
input x1 x2 x3 x4$;
cards;
123 234 345 A
-999 212 999 S
453 543 -998 Q
-998 768 -997 W
;
run;
data temp;
set x;
array x{*} _numeric_;
do i=1 to dim(x);
if x{i} in (&default_values) then continue;
else call missing(x{i});
end;
drop i;
run;
proc sql;
select x1,x2,x3
into :x_1 separated by ',' , :x_2 separated by ',' , :x_3 separated by ','
from temp ;
quit;
data result;
length variable $ 2
default_values $ 2000 ; *default_values's length can change to fit the number of your observations;
variable = 'x1' ;
default_values = compress(tranwrd("&x_1",'.,',' '),' .');
output;
variable = 'x2' ;
default_values = compress(tranwrd("&x_2",'.,',' '),' .');
output;
variable = 'x3' ;
default_values = compress(tranwrd("&x_3",'.,',' '),' .');
output;
run;
proc print noobs;
run;
[/pre]
Ksharp
Message was edited by: Ksharp
... View more