I have dataset CODE_100 and CODE_200. i want to store into variables FILTER_Code_100 AND FILTER_Code_200 all the fileds code so i can use them for queries.
SHould be something like FILTER_CODE_100 = 'A','B','C','D','E','F','G';
MACRO SINGLE_SEG(FLAG); SET WORK.CODE_&FLAG. END=EOF NOBS=NOBS; RETAIN STR_FLAGS; IF _N_= 1 THEN STR_FLAGS= CAT("'",CODE); ELSE STR_FLAGS= CATS(STR_FLAGS, "','", CODE);
i have tried already Call SYMPUT(FILTER_CODE_&FLAG.,CATS(STR_FLAG,"'"); Ans also %let FILTER_CODE_&FLAG. = CATS(STR_FLAG,"'");
But not successfully
Solved in this way
%MACRO CODE_TABLE(ListCode);
%GLOBAL Filter_&ListCode.;
PROC SQL NOPRINT;
SELECT QUOTE(TRIM(CODE),"'")
INTO :Filter_&ListCode. SEPARATED BY ', '
FROM TABELLA_CODE_TABLE WHERE Filter_ = "&ListCode.";
%put Filter_&ListCode. = &&&ListCode.;
QUIT;
%MEND CODE_TABLE;
%MACRO allCode(ELENCO);
DATA _NULL_;
SET &ELENCO;
CALL EXECUTE(CATS('%CODE_TABLE(', Filter_, ')'));
RUN;
%MEND AllCode;
%AllCode(WORK.table_distinct_code);
Thanks to everyone for helping