MACRO TWO BOBO: Unterschied zwischen den Versionen
		
		
		
		Zur Navigation springen
		Zur Suche springen
		
KKeine Bearbeitungszusammenfassung  | 
				KKeine Bearbeitungszusammenfassung  | 
				||
| (18 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 8: | Zeile 8: | ||
|übersicht=User Modules (from Phase-III Macro System)  | |übersicht=User Modules (from Phase-III Macro System)  | ||
}}  | }}  | ||
=  | {| class="wikitable"  | ||
! Workflow Graph  | |||
! Module Type  | |||
|-  | |||
| [[Datei:MACRO_TWO_BOBO.png|thumb|100px]]   | |||
| '''User module''' from [[Phase-III Macro System]] based on '''''[[Fraktal SAS Programming|Fractal System Architecture]]''. Build super row (=block) from boolean selections nested in boolean selection'''.  | |||
|}  | |||
== Source ==  | |||
==   | === Start Definition with Parameters and Defaults ===    | ||
;   |  %MACRO TWO_BOBO(dsn=,use=,use2=,row=,row2=,col=,indent=0,indinc=2,num=,total=T,stat=Y,weight=Y,rev=N,space=2,condense=,struct=,struct2=,head=Y,head2=N) / store des="Create hierarchy from two boolean vars";  | ||
=== Declares and Upper Level Processing ===    | |||
  %LOCAL n_lst v_lst row_n use_n n_grp v_grp n i name;  |   %LOCAL n_lst v_lst row_n use_n n_grp v_grp n i name;  | ||
| Zeile 30: | Zeile 34: | ||
  %TOP_OUTC(dsn=top_freq,head=&HEAD,total=&TOTAL,stat=&STAT,indent=&INDENT,grp=&ROW,rev=&REV,use=&USE,by=&COL);  |   %TOP_OUTC(dsn=top_freq,head=&HEAD,total=&TOTAL,stat=&STAT,indent=&INDENT,grp=&ROW,rev=&REV,use=&USE,by=&COL);  | ||
  %IF &STRUCT2 eq %THEN %LET struct2=top_filt;  |   %IF &STRUCT2 eq %THEN %LET struct2=top_filt;  | ||
=== Loop for Lower Level Processing ===   | |||
  %DO n=1 %TO &N_LST;  |   %DO n=1 %TO &N_LST;  | ||
    %LET row_n = %SCAN(%SCAN(&V_LST,&N,|),1,#);  |     %LET row_n = %SCAN(%SCAN(&V_LST,&N,|),1,#);  | ||
| Zeile 42: | Zeile 49: | ||
    %END;  |     %END;  | ||
  %END;  |   %END;  | ||
=== Care for Naming and Send Completion Mail ===   | |||
  %IF &TAB_NAME ne %THEN %DO;  |   %IF &TAB_NAME ne %THEN %DO;  | ||
    data %SUBSTR(&TAB_NAME,1,3)&NUM%SUBSTR(&TAB_NAME,5,4);  |     data %SUBSTR(&TAB_NAME,1,3)&NUM%SUBSTR(&TAB_NAME,5,4);  | ||
| Zeile 58: | Zeile 68: | ||
  %END;  |   %END;  | ||
  %GEN_MAIL(name=&NAME);  |   %GEN_MAIL(name=&NAME);  | ||
=== Close Definition ===   | |||
  %MEND TWO_BOBO;  |   %MEND TWO_BOBO;  | ||
== Parameters ==  | |||
{| class="wikitable"  | |||
|-  | |||
!Name !! Values !!Description  | |||
|-  | |||
|dsn || string || input dataset name  | |||
|-  | |||
|row, row2 || string || categorial variable name, 2=list of nested_var#true_value  | |||
|-  | |||
|rev || Y/N || output decodes of &ROW in reverse order  | |||
|-  | |||
|use, use2 || string || select decode from &ROW, 2=decode from &ROW used as nesting context  | |||
|-  | |||
|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 vertical position of totals  | |||
|-  | |||
|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  | |||
|}  | |||
Aktuelle Version vom 28. Oktober 2014, 15:53 Uhr
| Workflow Graph | Module Type | 
|---|---|
| User module from Phase-III Macro System based on Fractal System Architecture. Build super row (=block) from boolean selections nested in boolean selection. | 
Source
Start Definition with Parameters and Defaults
%MACRO TWO_BOBO(dsn=,use=,use2=,row=,row2=,col=,indent=0,indinc=2,num=,total=T,stat=Y,weight=Y,rev=N,space=2,condense=,struct=,struct2=,head=Y,head2=N) / store des="Create hierarchy from two boolean vars";
Declares and Upper Level Processing
%LOCAL n_lst v_lst row_n use_n n_grp v_grp n i name; %LET name=TWO_BOBO; %IF &STRUCT eq %THEN %LET struct =&DSN; %CHK_LIST(list=&ROW2); %GRP_DESC(dsn=&DSN,grp=&ROW,miss=n); %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=&REV,use=&USE,by=&COL); %IF &STRUCT2 eq %THEN %LET struct2=top_filt;
Loop for Lower Level Processing
%DO n=1 %TO &N_LST;
  %LET row_n = %SCAN(%SCAN(&V_LST,&N,|),1,#);
  %LET use_n = %SCAN(%SCAN(&V_LST,&N,|),2,#);
  %DO i=1 %TO &N_GRP;
    %IF %SCAN(&V_GRP,&I,|) eq &USE2 %THEN %DO;
      %ROW_FILT(dsn=&DSN,context=&ROW,subgrp=&I,grp=&ROW_N,by=&COL,var=,miss=n);
      %ROW_FREQ(dsn=row_filt,sum=top_freq,struct=&STRUCT2,context=&ROW,grp=&ROW_N,by=&COL,weight=&WEIGHT);
      %LET cursub=&N;
      %ROW_OUTC(dsn=row_freq,sum=,head=&HEAD2,stat=&STAT,indent=%EVAL(&INDENT+&INDINC),context=&ROW,grp=&ROW_N,use=&USE_N,by=&COL);
    %END;
  %END;
%END;
Care for Naming and Send Completion Mail
%IF &TAB_NAME ne %THEN %DO;
  data %SUBSTR(&TAB_NAME,1,3)&NUM%SUBSTR(&TAB_NAME,5,4);
   set
     row&NUM._0(where=(class not contains "Missing"))
     %IF &SPACE eq 1 %THEN dummy;
  %DO n=1 %TO &N_LST;
     %IF &SPACE eq 2 %THEN dummy;
     row&NUM._&N
  %END;
     %IF &SPACE eq 2 %THEN dummy;
     row&NUM._0(where=(class contains "Missing"))
     %IF &SPACE eq 3 %THEN dummy;
   ;
  run;
%END;
%GEN_MAIL(name=&NAME);
Close Definition
%MEND TWO_BOBO;
Parameters
| Name | Values | Description | 
|---|---|---|
| dsn | string | input dataset name | 
| row, row2 | string | categorial variable name, 2=list of nested_var#true_value | 
| rev | Y/N | output decodes of &ROW in reverse order | 
| use, use2 | string | select decode from &ROW, 2=decode from &ROW used as nesting context | 
| 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 vertical position of totals | 
| 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 | 
