Search code examples
stringsasrepeat

Printing Lines in SAS filled by "."


I have this code, but i think can be much easier

    
%MACRO Check_Global;

    %LET MaxLength = 35; 
    %LET Filler = %STR(..................................................);

    %DO i = 1 %TO %SYSFUNC(COUNTW(&V_Global));
        %LET Variab = %SCAN(&V_Global, &i);
        %LET Content = &&&Variab;
        %LET Padding = %SUBSTR(&Filler, 1, %EVAL(&MaxLength - %LENGTH(&Variab)));
        %PUT &Variab&Padding: &Content;
    %END;

%MEND;
%Check_Global;

RESULT:

Filter_UK..........................: '01'.'02'.'03'
Filter_USA.........................: '11'.'12'.'13'
......

Any other better and faster way to fill the header Filter_UK? Tried repeat but not working


Solution

  • %put _global_; will give you similar information.

    If you're just looking for a slightly prettier version that you can filter, you could also use a DATA step, like:

    %let V_global='SYSUSERID' 'SYSVER' ;
    data _null_ ;
      set sashelp.vmacro ;
      name=transtrn(name,' ','.') ;
      where offset=0 ;
      where also name IN (&v_global) ; 
      put @1 name @33 value ;
    run ;