Expliquer le code de la Transformation des colonnes caractère en numerique
Bonjour,
J'ai récupéré ce code sur ce site et il marche très bien .
je veux comprendre comment il marche, j'ai essayé mais c'est un peu complexe pour moi.
Ya t-il quelqu'un pour m'aider à le comprendre ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| %MACRO TO_CHAR;
PROC SQL NOPRINT ;
SELECT NAME, '_'!!NAME ,MAX (MONOTONIC()) INTO: OLD_VAR SEPARATED BY ',',: NEW_VAR SEPARATED BY ',' ,: NBR
FROM DICTIONARY.COLUMNS WHERE UPCASE (LIBNAME)='WORK' AND UPCASE (MEMNAME)='ma_table' AND UPCASE (TYPE)='NUM';
QUIT;
data table_sortie ( drop = %do i=1 %to &nbr. ; %scan("&new_var",&i,",") %end;);
SET ma_table ( RENAME=( %DO I=1 %TO &NBR. ; %SCAN("&OLD_VAR",&I,",")=%SCAN("&NEW_VAR",&I,",") %END; ) );
%DO I=1 %TO &NBR.;
%SCAN("&OLD_VAR",&I,",")=PUT(%scan("&NEW_VAR",&I,","), BEST.);
%END;
RUN;
%MEND; |
Merci