MACRO TWO CATV: Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
Zeile 19: Zeile 19:
 
== Source ==
 
== Source ==
  
;Start Definition with Parameters and Defaults
+
=== 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";
 
  %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
+
=== Declares and Upper Level Processing ===
  
 
  %LOCAL n_grp v_grp n name;
 
  %LOCAL n_grp v_grp n name;
Zeile 34: Zeile 34:
 
  %TOP_OUTC(dsn=top_freq,head=n,total=n,stat=&STAT,indent=&INDENT,grp=&ROW,rev=n,use=,by=&COL,missline=);
 
  %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
+
=== Loop for Lower Level Processing ===
  
 
  '''%DO n=1 %TO &N_GRP;'''
 
  '''%DO n=1 %TO &N_GRP;'''
Zeile 44: Zeile 44:
 
  '''%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;'''
Zeile 60: Zeile 60:
 
  %GEN_MAIL(name=&NAME);
 
  %GEN_MAIL(name=&NAME);
  
;Close Definition
+
=== Close Definition ===
  
 
  %MEND TWO_CATV;
 
  %MEND TWO_CATV;

Version vom 28. Oktober 2014, 15:11 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 Description
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)