As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips Talk:Using IFC to Conditionally Execute Global Statements

From sasCommunity
Jump to: navigation, search

Good TIP.
There are several similar function-terms, like IFN, etc. How they are named would be interesting to some (myself included.) I did a Google-search and ended up in the sasCommunity page describing one of them, but didn't learn any root-etymology. Obvious, now, is that IFC abbreviates, "IF-Conditionally". Charlie Shipp 03:11, 21 January 2010 (UTC)


Good Tip. In the data step, functions are type based so IFC is for character arguments and IFN is for numeric arguments. Since macro is a text manipulation language IFC is used here. --Don Henderson 14:05, 24 January 2010 (UTC)


Thanks. That sentence of explanation would be good for others also (in the tip, don't you think?) Charlie Shipp 03:02, 5 February 2010 (UTC)


Waiting for a third person to say, "OK"; and possibly Art to see if the added sentence is to his liking. HTH. Charlie Shipp 03:03, 12 February 2010 (UTC)


I undid the second sentance. Actually both IFN and IFC can be used with the macro language. It is not a matter of the arguments. IFC returns a character value, while IFN returns a numeric. When building code it is generally more useful to have a character result.

%let name=Fred;
%put %sysfunc(ifn(&name=Charlie,1,2,3));

--Art Carpenter 05:19, 12 February 2010 (UTC)


I added a bit of the above text to the tip. --Art Carpenter 23:08, 17 January 2011 (UTC)