Posts

Showing posts with the label New SAS Functions

IFC and IFN functions: New IF functions:

Objective: To Reduce the amount of typing required achieving an objective Syntax: IFN (condition, true, false, missing): ‘N’ stands for Numeric IFN returns a numeric value. It returns the true, false or missing value depending on whether the condition is true, false or missing. Syntax: IFC (condition, true, false, missing): ‘C’ stands for character IFC function has four parameters: 1) a logical expression 2) character value returned when true 3) value returned when false 4) value retuned when missing, which is optional. IFC (logical-expression, Character-value-returned-when-true, Character-value-returned-when-false, Character-value-returned-when-missing); IFC returns a character value. It returns the true, false or missing value depending on whether the condition is true, false or missing. Example: Assign a value to the VISIT variable (new) as per the VTYPE variable value. We can certainly achieve this task in diff. ways.. here are they... data old; input sitesub $ vtype vdate $; card...

Concatenation FUNCTIONS & CALL ROUTINES:

CATS/CATT/CATX Call Routines CAT/CATS/CATT/CATX Functions These Functions and Call Routines can be used to join two or more strings together. Even though we can use the concatenation operator in combination with the STRIP, TRIM, or LEFT functions, these functions make it much easier to put strings together and if you wish, to place one or more separator characters between the strings. One advantage of using the call routines than the functions is improved performance. Note: *Call routine executes faster than the function… in specific… CALL CATS: To concatenate two or more strings, removing both leading and trailing blanks. CATS () stands for concatenate and strip. Just think the ‘S’ at the end of the CATS as “Strip Blanks”. Syntax: CALL CATS (result, string-1<, string-n>); Example: A=”ABC’; B=” CONSULTING”; C=”INC “; D=” TEAM “; FUNCTION= RESULT CALL CATS(RESULT, A,B)= "ABCCONSULTING" CALL CATS(RESULT, A,B,C)= "ABCCONSULTINGINC" CALL CA...