Process Metadata: Direct (from Fraktal SAS Programming): Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „== Generate == Partially, step 1 in direct approach looks quite familiar from the numbered approach except that no parameters are populated, neither a segment…“)
 
K
 
Zeile 1: Zeile 1:
 +
[[Kategorie:zazy]]
 +
{{SeitenNavigation1
 +
|links=xx_left.png
 +
|zurück=Process Metadata: Numbered (from Fraktal SAS Programming)
 +
|rechts=xx_right.png
 +
|vorwärts=Process Metadata: List (from Fraktal SAS Programming)
 +
|hoch=Duck_zazy_com.png
 +
|übersicht=Process Metadata (from Fraktal SAS Programming)
 +
}}
 +
 
== Generate ==
 
== Generate ==
  
Zeile 53: Zeile 63:
  
 
Obviously the DIRECT approach is 1st choice when the number of parameters exceeds limits imposed by LIST getting too long or oversight getting lost in the NUMBERED approach.
 
Obviously the DIRECT approach is 1st choice when the number of parameters exceeds limits imposed by LIST getting too long or oversight getting lost in the NUMBERED approach.
 +
 +
{{SeitenNavigation1
 +
|links=xx_left.png
 +
|zurück=Process Metadata: Numbered (from Fraktal SAS Programming)
 +
|rechts=xx_right.png
 +
|vorwärts=Process Metadata: List (from Fraktal SAS Programming)
 +
|hoch=Duck_zazy_com.png
 +
|übersicht=Process Metadata (from Fraktal SAS Programming)
 +
}}

Aktuelle Version vom 30. Januar 2014, 10:52 Uhr

Zurück

Übersicht

Vorwärts

Generate

Partially, step 1 in direct approach looks quite familiar from the numbered approach except that no parameters are populated, neither a segmented list, nor a limited number of single values.

/*
generate the list itself
*/
proc sql noprint;
create table age_list as
select distinct age
  from sashelp.class
;
quit;

As indicated by the name, the direct approach leaves parameter values in the data table until needed. When necessary, the value is DIRECTLY read into a parameter and used instantly.


Count

Determination of the number of elements remains totally unchanged.

/*
obtain the number of elements
*/
data _null_;
 set age_list end = eof;
if eof then do;
call symput("age_grps",trim(left(put(_N_,8.))));
end;
run;


Utilize

As promised, the loop hosting the utilization of parameter values also populates the parameter directly from the data table.

This approach makes use of the SAS Systems capability for direct record access. Whereas default SAS data table access is performed sequentially, it is also possible to directly jump to a specific record and read until an also specified record number. When data set options FIRSTOBS and OBS are set identical, then exactly one record is directly accessed and read.

/*
utilize list elements 
*/
%DO age_indx = 1 %TO &AGE_GRPS.;
data _null_;
 set age_list(firstobs = &AGE_INDX. obs = &AGE_INDX.);
call symput("age_grp",trim(left(put(age,8.))));
run;
proc print noobs
     data = sashelp.class
;
where age = &AGE_GRP.;
run;
%END;

Obviously the DIRECT approach is 1st choice when the number of parameters exceeds limits imposed by LIST getting too long or oversight getting lost in the NUMBERED approach.

Zurück

Übersicht

Vorwärts