MACRO TWO CATV: Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „== Parameters == {| class="wikitable" |- !Name !!Description |- | dsn || input dataset name |- | row, row2 || categorial variable name, 2=nested variable |- |…“)
 
K
 
(18 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
== Parameters ==
+
[[Kategorie:zazy]]
 +
{{SeitenNavigation1
 +
|links=xx_left.png
 +
|rechts=xx_right.png
 +
|hoch=FRAKTAL_MACRO_ARCHITECTURE.png
 +
|zurück=MACRO TAB CONV
 +
|vorwärts=MACRO TWO BOCA
 +
|übersicht=User Modules (from Phase-III Macro System)
 +
}}
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Workflow Graph
 +
! Module Type
 
|-
 
|-
!Name !!Description
+
| [[Datei:MACRO_TWO_CATV.png|thumb|100px]]
|-
+
| '''User module''' from [[Phase-III Macro System]] based on '''''[[Fraktal SAS Programming|Fractal System Architecture]]''. Build table from two nested categorial variables'''.
| dsn || input dataset name
 
|-
 
| row, row2 || categorial variable name, 2=nested variable
 
|-
 
| exclude || decode for excluded group from &ROW
 
|-
 
| weight || Y/N (multiply percentages for &ROW and &ROW2)
 
|-
 
| col || categorial variable name used for columns
 
|-
 
| head2 || Y/N (block header for 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 || 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)
 
 
|}
 
|}
  
 
== Source ==
 
== Source ==
%MACRO TWO_CATV(dsn=
 
                ,exclude=
 
                ,row=
 
                ,row2=
 
                ,col=
 
                ,indent=0
 
                ,num=
 
                ,stat=N
 
                ,weight=Y
 
                ,space=2
 
                ,condense=
 
                ,struct=
 
                ,struct2=
 
                ,head2=N
 
                ,misslin2=
 
                ,indinc=2)
 
/ store des=""
 
;
 
  
  /*
+
=== Start Definition with Parameters and Defaults ===
declares and upper level processing
+
 
*/
+
  %MACRO TWO_CATV(dsn=,exclude=,row=,row2=,col=,indent=0,num=,stat=N,weight=Y,space=2,condense=,struct=,struct2=,head2=N,misslin2=,indinc=2) / store des="MACRO TWO_CATV";
 +
 
 +
=== Declares and Upper Level Processing ===
 +
 
 
  %LOCAL n_grp v_grp n name;
 
  %LOCAL n_grp v_grp n name;
 
  %LET name=TWO_CATV;
 
  %LET name=TWO_CATV;
 
  '''%IF &STRUCT  eq %THEN %LET struct =&DSN;'''
 
  '''%IF &STRUCT  eq %THEN %LET struct =&DSN;'''
 
  '''%IF &STRUCT2 eq %THEN %LET struct2=&DSN;'''
 
  '''%IF &STRUCT2 eq %THEN %LET struct2=&DSN;'''
  %GRP_DESC(dsn=&DSN
+
  %GRP_DESC(dsn=&DSN,grp=&ROW,miss=n);
          ,grp=&ROW
+
  %TOP_FILT(dsn=&DSN,grp=&ROW,by=&COL,grplvl=&NUM,var=,condense=&CONDENSE);
          ,miss=n)
+
  %TOP_FREQ(dsn=top_filt,struct=&STRUCT,grp=&ROW,by=&COL);
;
+
  %TOP_OUTC(dsn=top_freq,head=n,total=n,stat=&STAT,indent=&INDENT,grp=&ROW,rev=n,use=,by=&COL,missline=);
  %TOP_FILT(dsn=&DSN
+
 
          ,grp=&ROW
+
=== Loop for Lower Level Processing ===
          ,by=&COL
+
 
          ,grplvl=&NUM
 
          ,var=
 
          ,condense=&CONDENSE)
 
;
 
  %TOP_FREQ(dsn=top_filt
 
          ,struct=&STRUCT
 
          ,grp=&ROW
 
          ,by=&COL)
 
;
 
  %TOP_OUTC(dsn=top_freq
 
          ,head=n
 
          ,total=n
 
          ,stat=&STAT
 
          ,indent=&INDENT
 
          ,grp=&ROW
 
          ,rev=n
 
          ,use=
 
          ,by=&COL
 
          ,missline=)
 
;
 
/*
 
loop for lower level processing
 
*/
 
 
  '''%DO n=1 %TO &N_GRP;'''
 
  '''%DO n=1 %TO &N_GRP;'''
 
   '''%IF %SCAN(&V_GRP,&N) ne &EXCLUDE %THEN %DO;'''
 
   '''%IF %SCAN(&V_GRP,&N) ne &EXCLUDE %THEN %DO;'''
     %ROW_FILT(dsn=&DSN
+
     %ROW_FILT(dsn=&DSN,context=&ROW,subgrp=&N,grp=&ROW2,by=&COL,var=,miss=n);
              ,context=&ROW
+
     %ROW_FREQ(dsn=row_filt,sum=top_freq,struct=&STRUCT2,context=&ROW,grp=&ROW2,by=&COL,weight=&WEIGHT);
              ,subgrp=&N
+
     %ROW_OUTC(dsn=row_freq,sum=main_3rd,head=&HEAD2,stat=&STAT,indent=%EVAL(&INDENT+&INDINC),context=&ROW,grp=&ROW2,by=&COL,missline=&MISSLIN2);
              ,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=main_3rd
 
              ,head=&HEAD2
 
              ,stat=&STAT
 
              ,indent=%EVAL(&INDENT+&INDINC)
 
              ,context=&ROW
 
              ,grp=&ROW2  
 
              ,by=&COL
 
              ,missline=&MISSLIN2)
 
    ;
 
 
   '''%END;'''
 
   '''%END;'''
 
  '''%END;'''
 
  '''%END;'''
/*
+
 
care for naming and send completion mail
+
=== 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 135: Zeile 59:
 
  '''%END;'''
 
  '''%END;'''
 
  %GEN_MAIL(name=&NAME);
 
  %GEN_MAIL(name=&NAME);
 +
 +
=== Close Definition ===
  
 
  %MEND TWO_CATV;
 
  %MEND TWO_CATV;
 +
 +
== Parameters ==
 +
 +
{| class="wikitable"
 +
|-
 +
!Name !! Values !!Description
 +
|-
 +
| dsn || string || input dataset name
 +
|-
 +
| row, row2 || string || categorial variable name, 2=nested variable
 +
|-
 +
| exclude || string || decode for excluded group from &ROW
 +
|-
 +
| weight || Y/N || multiply percentages for &ROW and &ROW2
 +
|-
 +
| col || string || categorial variable name used for columns
 +
|-
 +
| head2 || Y/N || block header for 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:25 Uhr

Zurück

Übersicht

Vorwärts

Workflow Graph Module Type
MACRO TWO CATV.png
User module from Phase-III Macro System based on Fractal System Architecture. Build table from two nested categorial variables.

Source

Start Definition with Parameters and Defaults

%MACRO TWO_CATV(dsn=,exclude=,row=,row2=,col=,indent=0,num=,stat=N,weight=Y,space=2,condense=,struct=,struct2=,head2=N,misslin2=,indinc=2) / store des="MACRO TWO_CATV";

Declares and Upper Level Processing

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

Loop for Lower Level Processing

%DO n=1 %TO &N_GRP;
  %IF %SCAN(&V_GRP,&N) ne &EXCLUDE %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=main_3rd,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 %SUBSTR(&TAB_NAME,1,3)&NUM%SUBSTR(&TAB_NAME,5,4);
  set
  %DO n=1 %TO &N_GRP;
    %IF &SPACE eq 1 %THEN dummy ;
    %IF %SCAN(&V_GRP,&N) ne &EXCLUDE %THEN row&NUM._&N ;
    %IF &SPACE eq 2 %THEN dummy ;
  %END;
    %IF &SPACE eq 3 %THEN dummy ;
   ;
  run;
%END;
%GEN_MAIL(name=&NAME);

Close Definition

%MEND TWO_CATV;

Parameters

Name Values Description
dsn string input dataset name
row, row2 string categorial variable name, 2=nested variable
exclude string decode for excluded group from &ROW
weight Y/N multiply percentages for &ROW and &ROW2
col string categorial variable name used for columns
head2 Y/N block header for 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