Hi Reeza, In the dataset I have five Flag Columns of numeric datatype. It contains data either 1 or no data(.) Task is to check if the column is flaged then their labels should be concatenated. If I use below statement, it will simply concatenate Labels for all the 5 variable irrespective of the data in it. DATA new;
SET old;
new_col = catx(', ',VLABEL(var1), VLABEL(var2), VLABEL(var3),
VLABEL(var4), VLABEL(var5));
RUN; So I though to write a Function as below so that I can pass each column to this function to get Label only when it contains data (doesn't matter what). And I got the errors as mention in my original post. (I forgot about function IFC to be honest 😞 ) PROC FCMP OUTLIB = work.usrfunc.label;
FUNCTION varlbl (var); IF NOT MISSING (var) THEN RETURN (VLABEL(var)); ENDSUB; RUN; DATA new;
SET old;
new_col = catx(', ', varlbl (var1), varlbl (var2), varlbl (var3), varlbl (var4), varlbl (var5)); RUN; I have now used IFC function. It is working for me and I am able to achieve what I want. But I still have this question, how we can use SAS function in PROC FCMP.
... View more