Studying for the SAS Advanced Cert exam and came across this problem in a practice exam. I do not understand why my PROC FCMP function does not return the same results as the same code in the data step. It only returns the first letter of the second word. data testscandata; infile cards dsd dlm='|'; input one $ two $ one_two $; datalines; one|two|one two one|two|one two one|two|one two one|two|one two ; run; PROC FCMP OUTLIB=WORK.FUNCTIONS.DEV; FUNCTION scantx (STRING $) $ 100; SCNOUT=catx(" ",scan(STRING,2), scan(STRING,1)); RETURN (SCNOUT); ENDSUB; RUN; OPTIONS CMPLIB=WORK.FUNCTIONS; DATA TEST_FUNC; SET WORK.testscandata; two_one_func = scantx(one_two); two_one_test = catx(" ",scan(one_two,2), scan(one_two,1)); RUN;
... View more