Bonjour,
Je voudrais réaliser une macro qui me retourne 1 si la variable existe dans la colonne indiquée de la table et 0 sinon, j'ai fé la macro suivante mais il y'a un prob. Merci bien d'avance pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 %macro VarExiste(table,colonne,variable); proc sql; select count(*) into :nb from &table; select &colonne into :val separated by '|' from &table; quit; %do i=1 %to &nb; %let var&i=%scan(&val,&i,'|'); %if &variable=&&var&i %then %do; %let existe=1; %end; %else %do; %let existe=0; %end; %end; &existe %mend; %VarExiste(sasuser.teste,code_ind,Ind1);
Partager