As the first step in the decommissioning of 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:Macro Language Formatted Look-up

From sasCommunity
Jump to: navigation, search
proc format;
    value $sitecode
        "KETCHIKAN"  = 'A_KTN_' 
        "POW"        = 'B_POW_' 
        "PETERSBURG" = 'C_PTG_' 
        "YAKUTAT"    = 'H_YAK_'
        other        = 'UNK   ';
%let site = POW; %* Just an example in this code snippet;
%let code = %sysfunc(putc(&site,$sitecode.));
%put &=code;

The use of formats to perform table look-ups is very common in the DATA step.

Did you know that you can also use formats in to perform table look-ups in the macro language?

The key is to use %SYSFUNC with the PUTC and PUTN functions, which are execution time versions of the PUT function. more more

Submitted By Art Carpenter (talk)