a simplified case:
format
value fmt
1= 'one'
...
111= 'one'
2= 'two'
...
299= 'two'
...
other = 'Others'
;
run;
when applied this format on the variable A, i want to subset the data
set which A values are 'others'. such as
data new;
set old;
format A fmt.;
run;
data sub
set new;
if A = "Others"; /*Where the error happens*/
run;
This seems cannot be done. A and "Other" are not of the same data
type. How can I do this ?
h********o 发帖数: 103
2
proc format;
value fmt 1 = "one" 11 = "one" 111 = "one"
2 = "two" 22 = "two" 222 = "two"
other = "Others";
run;
data one;
input A @@;
format A fmt.;
cards;
1 11 111 2 22 222 123 432
;
data two;
set one;
if(put(A,fmt.)) = "Others";
run;
proc print;
run;
Obs A
1 Others
2 Others