MACRO ROW UNIV: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „== Source == %MACRO ROW_UNIV(dsn=,context=,by=,var=,stats=N NMISS,misscol=) / store des="Calculate values for continuous variables"; %LOCAL name n_lst v_ls…“) |
K |
||
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
+ | [[Kategorie:zazy]] | ||
+ | {{SeitenNavigation1 | ||
+ | |links=xx_left.png | ||
+ | |rechts=xx_right.png | ||
+ | |hoch=FRAKTAL_MACRO_ARCHITECTURE.png | ||
+ | |zurück=MACRO ROW FREQ | ||
+ | |vorwärts=MACRO TOP OUTC | ||
+ | |übersicht=Core Modules (from Phase-III Macro System) | ||
+ | }} | ||
+ | |||
+ | == Type == | ||
+ | |||
+ | '''Core module''' from [[Phase-III Macro System]] based on '''''[[Fraktal SAS Programming|Fractal System Architecture]]'''''. | ||
+ | |||
== Source == | == Source == | ||
Aktuelle Version vom 5. März 2014, 21:08 Uhr
Type
Core module from Phase-III Macro System based on Fractal System Architecture.
Source
%MACRO ROW_UNIV(dsn=,context=,by=,var=,stats=N NMISS,misscol=) / store des="Calculate values for continuous variables";
%LOCAL name n_lst v_lst i; %LET name=ROW_UNIV; %GLOBAL CURBY CURDSN CURMISS CURCON CURSTATS; %LET curby=&BY; %LET curdsn=&DSN; %LET curcon=&CONTEXT; %LET curmiss=&MISSCOL; %LET curstats=&STATS; %CHK_LIST(list=&CURSTATS); %IF &DSN ne and &BY ne and &VAR ne and &STATS ne and &MISSCOL ne %THEN %DO; proc univariate data=&DSN %IF %UPCASE(&MISSCOL) eq N %THEN (where=(&BY is not missing)); noprint ; by %IF &CONTEXT ne %THEN &CONTEXT; &BY; var &VAR; output out=univ %DO I = 1 %TO &N_LST; %SCAN(%SCAN(&V_LST,&I,"|"),1,"#") = %SCAN(%SCAN(&V_LST,&I,"|"),1,"#") %END; ; run; proc sql; create table order as select &BY %IF &CONTEXT ne %THEN , &CONTEXT; %DO I = 1 %TO &N_LST; , %SCAN(%SCAN(&V_LST,&I,"|"),1,"#") %END; from univ ; quit; proc transpose data = order out = work.&NAME(drop=_LABEL_ rename=(_NAME_=STAT)) prefix = VAL; %IF &CONTEXT ne %THEN by &CONTEXT; ; var %DO I = 1 %TO &N_LST; %SCAN(%SCAN(&V_LST,&I,"|"),1,"#") %END; ; run; %PUT &NAME._MESSAGE: Global macrovariables created: ; %PUT &NAME._MESSAGE: CURBY (current column variable used) = &CURBY ; %PUT &NAME._MESSAGE: CURDSN (current dataset used for read) = &CURDSN ; %PUT &NAME._MESSAGE: CURMISS (Create column for missing values) = &CURMISS ; %PUT &NAME._MESSAGE: CURSTATS (current statistics requested) = &CURSTATS ; %IF &CURCON ne %THEN %DO; %PUT &NAME._MESSAGE: CURCON (current context if subset used) = &CURCON ; %PUT &NAME._MESSAGE: Processing context is "&CONTEXT = &CURVAL(&CURLAB)". ; %END; %PUT &NAME._MESSAGE: Reading data from %UPCASE(&DSN). ; %PUT &NAME._MESSAGE: Output dataset %UPCASE(work.&NAME) created. ; %PUT ; %END; %ELSE %DO; %PUT vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv; %PUT &NAME._ERROR: Insufficient or missing Keyword Parameter(s).; %PUT &NAME._STATUS: Macro processing abended. ; %PUT &NAME._STATUS: Output dataset %UPCASE(work.&VAR) NOT created. ; %PUT ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^; %GEN_MAIL(name=&NAME,rc=1); %END;
%MEND ROW_UNIV;