MACRO TWO BOCA

Aus phenixxenia.org
Version vom 28. Oktober 2014, 15:47 Uhr von Wolf-Dieter Batz (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Zurück

Übersicht

Vorwärts

Workflow Graph Module Type
MACRO TWO BOCA.png
User module from Phase-III Macro System based on Fractal System Architecture. Build super row (=block) from categorial variable nested in boolean selection.

Source

Start Definition with Parameters and Defaults

%MACRO TWO_BOCA(dsn=,use=,row=,row2=,col=,indent=0,num=,total=T,stat=Y,weight=Y,space=3,condense=,struct=,struct2=,head=Y,head2=Y,misslin2=,indinc=2) / store;

Declares and Upper Level Processing

%LOCAL n_grp v_grp n name;
%LET name=TWO_BOCA;
%IF &STRUCT  eq %THEN %LET struct =&DSN;
%IF &STRUCT2 eq %THEN 
%TOP_FILT(dsn=&DSN,grp=&ROW,grp2=&ROW2,by=&COL,grplvl=&NUM,var=,condense=&CONDENSE);
                %ELSE 
%TOP_FILT(dsn=&DSN,grp=&ROW,grp2=,by=&COL,grplvl=&NUM,var=,condense=&CONDENSE);
%TOP_FREQ(dsn=top_filt,struct=&STRUCT,grp=&ROW,by=&COL);
%TOP_OUTC(dsn=top_freq,head=&HEAD,total=&TOTAL,stat=&STAT,indent=&INDENT,grp=&ROW,rev=n,use=&USE,by=&COL);
%GRP_DESC(dsn=&DSN,grp=&ROW,miss=n);
%IF &STRUCT2 eq %THEN %LET struct2=top_filt;

Loop for Lower Level Processing

%DO n=1 %TO &N_GRP;
  %IF %SCAN(&V_GRP,&N) eq &USE %THEN %DO;
    %ROW_FILT(dsn=&DSN,context=&ROW,subgrp=&N,grp=&ROW2,by=&COL,var=,miss=n);
    %ROW_FREQ(dsn=row_filt,sum=top_freq,struct=&STRUCT2,context=&ROW,grp=&ROW2,by=&COL,weight=&WEIGHT);
    %ROW_OUTC(dsn=row_freq,sum=,head=&HEAD2,stat=&STAT,indent=%EVAL(&INDENT+&INDINC),context=&ROW,grp=&ROW2,by=&COL,missline=&MISSLIN2);
  %END;
%END;

Care for Naming and Send Completion Mail

%IF &TAB_NAME ne %THEN %DO;
  data &TAB_DEF&NUM%SUBSTR(&TAB_NAME,5,4);
   set
    %IF &SPACE eq 1                  %THEN dummy ;
     row&NUM._0
    %IF &SPACE eq 2                  %THEN dummy ;
     row&NUM._&CURSUB
    %IF &SPACE eq 2                  %THEN dummy ;
    %IF &SPACE eq 3                  %THEN dummy ;
   ;
  run;
%END;
%GEN_MAIL(name=&NAME);

Close Definition

%MEND TWO_BOCA;

Parameters

Name Values Description
dsn string input dataset name
row, row2 string categorial variable name, 2=nested variable
use string decode for selected group from &ROW
weight Y/N multiply percentages for &ROW and &ROW2
col string categorial variable name used for columns
total T/I/B/O/N/TC/IC/BC/OC/NC define totals vertical position
head, head2 Y/N block header, 2=nested variable
indent, indinc n number of indent columns and increment for nested variable
num n sequence number of output
stat Y/N column with statistics names
space 1/2/3 blank line before or after output and between nesting levels
struct, struct2 string name of reference dataset used for full decode structure, 2=nested variable
condense var#value non-distinct variable and true value for &ROW
misslin2 Y/N force missing line for nested variable