1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| data test;
input lb_bo :$20. var var1 var2 $ var3 $;
cards;
RIVAGE . 2 3 a b
PROGRES 2 3 4 . C
VIE2000 2 . 4 l .
;
run;
proc sql;
select case type
when 'num' then catx ( ' '
, 'left( put ('
, name
, ','
, case
when format is null then 'best12.'
else format
end
, ') ) as'
, name
)
when 'char' then name
else catx ( ' '
, quote('Error on type')
, 'as'
, name
)
end
into : selections separated by ' , '
from dictionary.columns
where libname='WORK' and memname='TEST' ;
create table allchar as select &selections from test;
select name
into : selection1 separated by ' '
from dictionary.columns
where libname='WORK' and memname='ALLCHAR' and name ne 'lb_bo' ;
quit;
data allchar1(drop=i);
retain LB_BO &selection1.;
set allchar;
array char &selection1.;
do i=1 to dim(char);
if char(i)=' ' or char(i)='.' then char(i) = "bloquant"; else char(i) = 'NON';
end;
if LB_BO = 'RIVAGE' then LB_BO='BO_RIVAGE';
if LB_BO = 'PROGRES' then LB_BO = 'BO_PROGRES';
if LB_BO = 'VIE2000' then LB_BO = 'BO_VIE2000';
run; |