Know How:BusinessIntelligence:SAS:Makros

Aus Ralph's Wiki
Wechseln zu: Navigation, Suche

Hauptseite > Know How > Business Intelligence > SAS > Makros

SAS
Allgemeines GlossarDokumentation
Themen SicherheitInstallationKonfigurationAdministrationTroubleshooting
Links ImportExportMacro
Solutions Risk Dimensionsxxx
Tipps MetadatenMakrosJavaNETJSPDATA StepSQLRegExpHashFormateInformation Maps
Tipps:Reporting WebReportStudioInformation Maps
ODS AllgemeinPROC TEMPLATELinks
Internationalization AllgemeinKonfiguration

Inhaltsverzeichnis

Allgemeines

Prüfungen

Datei existiert

In Makro Code In Datastep Code
   %if %SYSFUNC(FILEEXISTS(&file)) %then %do;
 

Datei existiert nicht

In Makro Code In Datastep Code
   %if %SYSFUNC(FILEEXISTS(&file)) ^= 1 %then %do;

Dataset existiert

Achtung! Es wird wirklich geprüft ob es ein DATASET ist und ob es existiert. Views mit gleichem Namen werden als nicht vorhanden angezeigt.

In Makro Code In Datastep Code
    %if %SYSFUNC(EXIST(dsname)) %then %do;
 
    %if %SYSFUNC(EXIST(dsname, %nrstr(DATA))) %then %do;

oder

    %let exist=%SYSFUNC(EXIST(dsname));
 
    %let exist=%SYSFUNC(EXIST(dsname, %nrstr(DATA)));

View existiert

In Makro Code In Datastep Code
    %if %SYSFUNC(EXIST(dsname, %nrstr(VIEW))) %then %do;

oder

    %let exist=%SYSFUNC(EXIST(dsname, , %nrstr(VIEW)));

Variable in Dataset Existiert

In Makro Code In Datastep Code
%macro CheckColumnExists(varname);
	%local dsid vnum;
 
	%let dsid=%sysfunc(open(<LIBNAME.TABNAME>));
	%let vnum=%sysfunc(varnum(&dsid, &varname.));
	%let dsid=%sysfunc(close(&dsid )) ;
 
	&vnum
%mend CheckColumnExists;
 
%macro TEST();
	%if %CheckColumnExists(ANR) %then
		%put ANR: YES (&rc.);
	%else
		%put ANR: NO  (&rc.);
	;
%mend TEST;
 
%TEST();
%let VARNAME=count;
 
data _null_;
   dsid=open('test');
   check=varnum(dsid,&VARNAME.);
   if check=0 
   then put 'Variable does not exist';
   else put "Variable located in column " check +(-1) '.';
run;

Bearbeiten von Datasets

Encoding anpassen für alle Datasets

Makro Code
%macro CORRECTENCODING(PAR_LIBNAME);
    %put IRLOG: Get all datasets in library &PAR_LIBNAME.;
    %put %sysfunc(pathname(&PAR_LIBNAME));
 
    proc datasets library=&PAR_LIBNAME nodetails memtype=data;
        contents out=work.listofdatasets (keep=memname) data=_all_ noprint;
    run;
 
    proc sql;
        select  distinct memname into :DATASETS separated by ' ' from work.listofdatasets;
    quit;
 
    %put IRLOG: Correct all datasets: &DATASETS.;
 
    %let LOOP=1;
    %let MEMNAME=%qscan(&DATASETS.,&LOOP,%str( ));
 
    %do %while(&MEMNAME ne);
        %put IRLOG: Correct encoding for &MEMNAME. to latin1;
 
        proc datasets library=&PAR_LIBNAME nodetails;
            modify &MEMNAME./ correctencoding=latin1;
        run;
 
        %let LOOP=%eval(&LOOP+1);
        %let MEMNAME=%qscan(&DATASETS,&LOOP,%str( ));
    %end;
 
%mend  CORRECTENCODING;
%CORRECTENCODING(AAPARM);


Informationen über Datasets

Anzahl Variablen

Makro Code Datastep Code PROC SQL
 
 
proc sql noprint;
   select nvar into :NROFVARS
   from   dictionary.tables
   where  libname="&LIBNAME" and memname="&TABNAME";
 
   select distinct(NAME) into :VAR1-:VAR%TRIM(%LEFT(&NROFVARS))
   from   dictionary.columns
   where  libname="&LIBNAME" and memname="&TABNAME";
quit;

Liste Variablen mit bestimmten Namen

Makro Code
%macro GET_LISTOF_VARS(DSNAME, PREFIX);
	%local _list _name _dsid _loop _length;
 
	%let _dsid = %sysfunc(open(&DSNAME));
 
	%if &_dsid %then %do;  
		%let _length=%length(&PREFIX);
 
		%do _loop=1 %to %sysfunc(attrn(&_dsid,nvars)) ;  
			%let _name =%sysfunc(varname(&_dsid ,&_loop));
 
			%if ("&PREFIX" ne "") %then %do;
				%let _prefix=%substr(&_name, 1, &_length);
 
				%if (&_prefix ne &PREFIX) %then %do;
					%let _name=;
				%end;
			%end;
 
			%if (&_name ne "") %then %do;
				%let _list = &_list &_name;
			%end;
		%end ; 
 
		%let _dsid = %sysfunc(close(&_dsid ));  
	%end; 
 
	&_list 
%mend GET_LISTOF_VARS;
data test;
	array varlist(*) $64 %GET_LISTOF_VARS(WORK.DEMO, Attr);
 
	set CONFIG.PORTAL_PERMISSIONS;
 
	varlist(1)= .;
run;

Arbeiten mit Makrovariablen

Nicht initialisierte Variablen

Prüfen ob eine Variable existiert

	%if (%symexist(VAR) = 0) %then %let VAR=;
	%put VAR=&VAR.;

Um eine Warnmeldung für nicht initialisierte Variablen zu vermeiden, kann der folgende Programmcode verwendet werden:

	%if %symexist(COMMENT) %then %if %str(&COMMENT.) ne %nrstr() %then %do;
	   %put COMMENT=&COMMENT.;
	%end;

Liste in einer Makrovariablen speichern

Makro Code
data _null_;
   length varlist$1000;
   retain varlist' ';
 
    set work.metainfo end=eof;
   *varlist = trim(left(varlist)) || ' ' || left(NAME);
   varlist = cats(' ', varlist, NAME);
 
   if eof then call symput('varlist', varlist);
run;
 
%put &varlist;

Oder mit Hilfe der Funktion %RESOLVE:

Makro Code
data _null_;
   set work.metainfo;
   call symput('varlist',trim(resolve('&varlist')) || ' ' || trim(NAME));
run;   
%put &varlist;

Liste der Variablen (als Makro)

Quelle: [1]

Makro Code
%macro GetListOfVars(DSNAME) ;
    %local varlist ;
    %local loop ;
 
    /* open dataset */
    %let dsid = %sysfunc(open(&DSNAME)) ;
 
    /* If accessable, process contents of dataset */
    %if &dsid %then %do ;
        %do loop=1 %to %sysfunc(attrn(&dsid,nvars)) ;
           %let varlist = &varlist %sysfunc(varname(&dsid ,&loop));
        %end ;
 
        /* close dataset when complete */
        %let dsid = %sysfunc(close(&dsid )) ;
    %end ;
 
    &varlist 
%mend ;

Mehrere Makrovariablen zusammenfassen

Makro Code
	%let INPUT_LIST=;
	%let LOOP=0;
	%do %while (%symexist(_INPUT&LOOP));    
		%let INPUT_LIST=&INPUT_LIST. &&_INPUT&LOOP;
 
		%let LOOP=%eval(&LOOP+1);
	%end;

Arbeiten mit Makroparameter

Ersetzung von Zeichen

Wird eine Liste von Feldnamen als Parameter übergeben, so entsteht das Problem, das in SQL-Anweisungen die Feldnamen durch Kommans getrennt werden, aber in einem DATASTEP (z.b. in der BY Anweisung) durch Leerzeichen.

Um dieses Problem zu lösen, werden die Feldname als Liste durch Lerrzeichen getrennt übergeben und für die SQL-Anweisungen entsprechend angepaßt:

Makro Code
%macro BeispielMitFeldListenParameter(KEYLIST=);
	%let KEYLIST_SSV=&KEYLIST;
	%let KEYLIST_CSV=%ReplaceInString(&KEYLIST, ' ', ',');
%mend;

Die Ersetzung erfolgt durch das nachfolgende Makro:

%macro ReplaceInString(source, from, to);
  %local rx times SOURCE TARGET;
  %let times = 999;
 
  %let SOURCE=&source;
 
  %let rx = %sysfunc (rxparse ( &from TO &to ));
  %syscall rxchange(rx, times, SOURCE, TARGET);
  %syscall rxfree(rx);
 
  &TARGET
%mend;

Werte zuweisen

Datum und Uhrzeit

%let datetimestamp = %sysfunc(date(),date9.)-%left(%sysfunc(time(),hhmm2.)):%substr(%sysfunc(time(),hhmm5.),4);
 
%put &datetimestamp;

Zeichenfolgen

DSN Name aufteilen

proc sql;
   select name, type, length
      from dictionary.columns
      where libname="%upcase(%scan(&dsn,1,.))" and
            memname="%upcase(%scan(&dsn,2,.))";
quit;

DataStep

Beispiele

Word Count 1

This nice little macro will help do a word count on variables of text data:
 
    %macro nwords ( s ) ;
        ((length (compbl(left(&s))) - length (compress(left(&s))) + 1)
        * (&s ne ‘’))
    %mend nwords ;

Word Count 2

    %macro wordcount(list);
        %* Count the number of words in &LIST;
 
        %local count;
        %let count=0;
 
        %do %while(%qscan(&list,&count+1,%str( )) ne %str());
            %let count = %eval(&count+1)
        %end;
 
        &count
    %mend wordcount;

Für jedes Wort in einem String eine Macro-Variable erstellen

%macro test(string);
  %local count word;
 
  /* Intialize COUNT */
  %let count=1;
 
  /* Assign the first value in the string to the macro variable var1*/
  %let var&count=%qscan(&string,&count,%str( ));
 
  /* This loop will continue to loop as long as VAR&COUNT has a value */
  %do %while(&&var&count ne);
 
    /* Increment the value of COUNT for each iteration of the DO loop */
    %let count=%eval(&count+1);
 
    /* Create a different macro variable for each 'word' in the string */
    %let var&count=%qscan(&string,&count,%str( ));
  %end;
 
  /* Capture the final number of 'words' in the string */
  %let count=%eval(&count-1);
 
  /* DO loop to write the values of the newly created variables to the log */
  %do i=1 %to &count;
    %put &&VAR&I;
  %end;
%mend;
 
%test(a b c d e)

Anzahl ähnlicher Variablennamen zählen

%macro CountMaxVar;
	data _null_;
		%let loop=0;
		%do %while(%symexist(_INPUT&loop));
			%let loop=%eval(&loop+1);
		%end;
 
		%let _input_max=&loop;
 
		%put Anzahl Variablen: &_INPUT_MAX;
	run;
%mend;

Beispiele mit Datasteps

Makro für alle Eingabetabellen aufrufen

	%let loop=0;	
	%do %while (%symexist(_INPUT&loop));	
		%let DATASET=&&_INPUT&loop;
 
		%if &USELIBNAME = %str(Yes) %then %do;
			%let TABNAME=&&_INPUT&loop;
		%end;
		%else %do;
			%let TABNAME=%scan(&DATASET., 2, '.');
		%end;
 
		%let TABNAME=%sysfunc(lowcase(%nrbquote(&TABNAME)));
 
 
		%let loop=%eval(&loop+1);
	%end;

Makro für alle Datasets in einer Library aufrufen

In Makro Code In Datastep Code
%macro ACTION;
   %local LIBNAME TABNAME;
 
   %let LIBNAME=MYLIB;
 
   proc sql;
      select	memname into :TABLIST separated by ':'
      from	sashelp.vtable
      where	libname="&LIBNAME" and memtype='VIEW';
   quit;
 
   %let LOOP=1;
   %let TABNAME=%qscan(&TABLIST,&LOOP,%str(:));
 
   options nonotes; /* Prevent SQL Notes */
 
   %do %while(&TABNAME ne);
 
      proc sql noprint;
         select 	count(*) into :NROFENTRIES
         from	&LIBNAME..&TABNAME.
         ;
 
      quit;
 
      %put &TABNAME. enthält &NROFENTRIES. Einträge;
 
      %let LOOP=%eval(&LOOP+1);
      %let TABNAME=%qscan(&TABLIST,&LOOP,%str(:));
   %end;
 
%mend;
 
%ACTION;

Anzahl der Beobachtungen ermitteln

In Makro Code In Datastep Code
%global NUMOBS;
%macro NUMOBS(dsname);
   data _null_;
      if 0 then set &dsname nobs=NUMOBS;
      call symput('NUMOBS' ,put(NUMOBS , BEST.));
      stop;
   run;
%mend;

Alle Werte eines Dataset auslesen

Makro Code Datastep Code
%let dsid=%sysfunc(open(&_INTAB.));
%if &dsid %then %do;
   %let nobs=%sysfunc(attrn(&dsid, nobs));
   %put Auslesen der Liste der Tabellen aus &_INTAB.: &nobs Einträge;
 
   %do loop= 1 %to &nobs;
      %let obs=%sysfunc(fetchobs(&dsid,&loop.));
      %let _VALUE=%sysfunc(getvarc(&dsid,1));
 
      %if &_VALUE. ne %str(DUMMY) %then %do;	
         %let _LIBFROM=%scan(&_VALUE., 1, '.');
         %let _TABFROM=%scan(&_VALUE., 2, '.');
 
      %end;
   %end;
 
   %let dsid=%sysfunc(close(&dsid));
%end;

Datastep Code aus der Definition erstellen

%macro createDataStepFromDefinition(lib=,dsname=);
   /* Create infile/input datastep */
   data _null_;
	   length  	vlength 					$5 
					vname 					$32 
					vtype 					$1 
					vfmt vinfmt 			$10 
					vlabel 					$40
					vlen   					$10
           		statementAttrib      $32000;
 
		drop dsid loop num rc;
 
		dsid=open("&lib..&dsname","i");
		num=attrn(dsid,"nvars");
 
 
		/**/
		put "data &lib..&dsname;";
 
      do loop=1 to num;
			statementAttrib='';
 
      	vlength = strip(put(varlen(dsid, loop), 5.));
 
         vname  = varname(dsid,loop);
         vtype  = vartype(dsid,loop);
         vfmt   = varfmt(dsid,loop);
         vinfmt = varinfmt(dsid,loop);
         vlabel = varlabel(dsid,loop);
         vlen   = varlen(dsid,loop);
 
 
			/* Length */
			statementAttrib = trimn(statementAttrib) !! ' attrib ' !! varname(dsid,loop) !! ' length = ';
 
			if vtype = 'C' then do;    
				statementAttrib = trimn(statementAttrib) !! '$';
			end;
 
			statementAttrib = trimn(statementAttrib) !! vlength;
 
        	/* Format */
        	if vfmt ne '' then
         	statementAttrib = trimn(statementAttrib) !! ' format = ' !! vfmt;
 
        	/* Informat */
        	if vinfmt ne '' then
				statementAttrib = trimn(statementAttrib) !! ' informat = ' !! vinfmt;
 
        	/* Label */
			/*
        	if vlabel ne '' then
				statementAttrib = trimn(statementAttrib) !! " label = '" !! vlabel !! "'";
			*/
 
			/* Generieren einer Variablen-Liste für das Input-Statement */
			statementAttrib = trimn(statementAttrib) !! '; '; 
 
			/**/
			put statementAttrib;
		end; 
 
		/**/
		put "stop;";
 
		if dsid > 0 then dsid = close(dsid);
	run;
%mend;
 
%let lib=praes;
%let dsname=rawdatasubset;
 
%createDataStepFromDefinition(lib=&lib, dsname=&dsname)

Troubleshooting

Ausgabe des Wordscanner/Makroparser in einer Datei speichern

filename mprint 'dateiname';
options mprint mfile;
 
%makroaufruf

Makrovariablen

Original liegt hier [2]

Variable Name Used By Description
_ABSTRACT

%STPBEGIN/
%STPEND

Text string briefly describing a package created by %STPBEGIN and %STPEND.

_ACTION Web Clients

Specifies an action for the Web application to take. Possible values for this variable are as follows:

FORM
displays custom input form if one exists. If FORM is the only value for _ACTION, and no form is found, then an error is generated.
EXECUTE
executes the stored process.
PROPERTIES
displays the property page, which enables you to set input parameters and execution options and to execute the stored process.
BACKGROUND
executes the stored process in the background.
STRIP
removes null parameters. This value can only be used in combination with EXECUTE and BACKGROUND.
INDEX
displays a tree of all stored processes.
DATA
displays a summary of general stored process data. Values for _ACTION are case insensitive. Multiple values can be combined (except when using INDEX or DATA). Two common combinations are:
_ACTION=FORM,PROPERTIES
displays a custom input form if one exists, otherwise displays the property page.
_ACTION=FORM,EXECUTE
displays a custom input form if one exists, otherwise executes the stored process.
_ADDRESSLIST_DATASET_LIBNAME, _ADDRESSLIST_DATASET_MEMNAME, _ADDRESSLIST_VARIABLENAME, _DATASET_OPTIONS

%STPBEGIN/
%STPEND

Specifies a data set containing email addresses when _RESULT is set to PACKAGE_TO_EMAIL.
_APSLIST Stored Process Server List of the names of all the parameters that were passed to the program.
_ARCHIVE_FULLPATH

%STPBEGIN/
%STPEND

Full path and name of an archive package created by %STPEND when _RESULT is set to PACKAGE_TO_ARCHIVE or PACKAGE_TO_REQUESTER. This value is set by %STPEND and is an output value only. Setting it before %STPEND has no effect.

_ARCHIVE_NAME

%STPBEGIN/
%STPEND

Name of the archive package to be created when _RESULT is set to PACKAGE_TO_ARCHIVE. If this value is not specified or is blank and _RESULT is set to PACKAGE_TO_ARCHIVE or PACKAGE_TO_REQUESTER, then the package is created with a new, unique name in the directory specified by _ARCHIVE_PATH. This value is set through the stored process service API and cannot be directly overridden by a client input parameter.
_ARCHIVE_PATH

%STPBEGIN/
%STPEND

Path of the archive package to be created when _RESULT is set to PACKAGE_TO_ARCHIVE or PACKAGE_TO_REQUESTER. This value is set through the stored process service API and cannot be directly overridden by a client input parameter. The special value TEMPFILE causes the archive package to be created in a temporary directory that exists only until the stored process completes executing and the client disconnects from the server.
_AUTHTYP Web Clients

Specifies the name of the authentication scheme used to identify a Web client, for example, BASIC or SSL, or "null" (no authentication.) This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_CHANNEL

%STPBEGIN/
%STPEND

Specifies a subscriber channel when _RESULT is set to PACKAGE_TO_SUBSCRIBERS. See [../app/pkgintf/pkg_publ.html PACKAGE_PUBLISH] for more information about channel names.

_COLLECTION_URL

%STPBEGIN/
%STPEND

URL of the WebDAV collection to be created when _RESULT is set to PACKAGE_TO_WEBDAV. See also [#_IF_EXISTS _IF_EXISTS]. This value is set through the stored process service API and cannot be directly overridden by a client input parameter.

_DEBUG Web Clients

Debugging flags. For information about setting the default value of _DEBUG, see [dbgsrvlt.html#setdebug Setting the Default Value of _Debug].

_DESCRIPTION

%STPBEGIN/
%STPEND

Descriptive text embedded in a package created by %STPBEGIN and %STPEND.

_DOMAIN Web Clients Authentication domain for the SAS Stored Process Web Application.
_EMAIL_ADDRESS

%STPBEGIN/
%STPEND

Specifies destination e-mail addresses when _RESULT is set to PACKAGE_TO_EMAIL. Multiple addresses can be specified using the [input.html#multi-value multiple value convention] for stored process parameters.

_ENCODING

%STPBEGIN/
%STPEND

Sets the encoding for all ODS output.
_EXPIRATION_DATETIME

%STPBEGIN/
%STPEND

Expiration datetime embedded in a package created by %STPBEGIN and %STPEND. Must be specified in a valid SAS datetime syntax.

_FROM

%STPBEGIN/
%STPEND

Specifies the e-mail address of the sender when _RESULT is set to PACKAGE_TO_EMAIL.
_GOPT_DEVICE, _GOPT_HSIZE, _GOPT_VSIZE, _GOPT_XPIXELS, _GOPT_YPIXELS

%STPBEGIN/
%STPEND

Sets the corresponding SAS/GRAPH option. See the DEVICE, HSIZE, VSIZE, XPIXELS, and YPIXELS options in "Graphics Options and Device Parameters Dictionary" in the SAS/GRAPH Reference in SAS Help and Documentation for more information.
_GOPTIONS

%STPBEGIN/
%STPEND

Sets any SAS/GRAPH option documented in "Graphics Options and Device Parameters Dictionary" in the SAS/GRAPH Reference in SAS Help and Documentation. You must specify the option name and its value in the syntax used for the GOPTIONS statement. For example, set _GOPTIONS to ftext=Swiss htext=2 to specify the Swiss text font with a height of 2.
_GRAFLOC Web Clients URL for the location of SAS/GRAPH applets. This variable is set to /sasweb/graph for most installations.
_HTACPT Web Clients

Specifies the MIME types accepted by the stored process client. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_HTCOOK Web Clients

Specifies all of the cookie strings the client sent with this request. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_HTREFER Web Clients

Specifies the address of the referring page. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_HTTP_PASSWORD

%STPBEGIN/
%STPEND

Password used (with _HTTP_USER) to access the WebDAV server when _RESULT is set to PACKAGE_TO_WEBDAV. This value is set through the stored process service API and cannot be directly overridden by a client input parameter.
_HTTP_PROXY_URL

%STPBEGIN/
%STPEND

Proxy server used to access the WebDAV server when _RESULT is set to PACKAGE_TO_WEBDAV. This value is set through the stored process service API and cannot be directly overridden by a client input parameter.
_HTTP_USER

%STPBEGIN/
%STPEND

User name used (with _HTTP_PASSWORD) to access the WebDAV server when _RESULT is set to PACKAGE_TO_WEBDAV. This value is set through the stored process service API and cannot be directly overridden by a client input parameter.
_HTUA Web Clients

Specifies the name of the user agent. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_IF_EXISTS

%STPBEGIN/
%STPEND

Can be NOREPLACE, UPDATE, or UPDATEANY. See [../app/pkgintf/pkg_publ.html#ifexists PACKAGE_PUBLISH] options for more information.

_MESSAGE_QUEUE

%STPBEGIN/
%STPEND

Specifies a target queue when _RESULT is set to PACKAGE_TO_QUEUE. See [../app/pkgintf/pkg_publ.html PACKAGE_PUBLISH] for more information about queue names. Multiple queues can be specified using the [input.html#multi-value multiple value convention] for stored process parameters.

_METAPERSON All Specifies the Person metadata name that is associated with the _METAUSER login variable. The value of this variable can be UNKNOWN. This variable cannot be modified by the client.
_METAUSER All Specifies the login username that is used to connect to the metadata server. This variable cannot be modified by the client.
_NAMESPACES

%STPBEGIN/
%STPEND

Applies to packages only. See [../app/pkgintf/pkg_begn.html PACKAGE_BEGIN] for more information about this variable.

_NAMEVALUE

%STPBEGIN/
%STPEND

A list of one or more name/value pairs used for filtering when generating packages. See [../app/pkgintf/pkg_begn.html PACKAGE_BEGIN] for more information about this variable.

_ODSDEST

%STPBEGIN/
%STPEND

Specifies the ODS destination. The default ODS destination is HTML if _ODSDEST is not specified. Valid values of _ODSDEST include the following:

  • CSV
  • CSVALL
  • TAGSETS.CSVBYLINE
  • HTML
  • LATEX
  • NONE (no ODS output is generated)
  • PDF
  • PS
  • RTF
  • SASREPORT
  • WML
  • XML
  • any tagset destination
_ODSOPTIONS

%STPBEGIN/
%STPEND

Specifies options to be appended to the ODS statement. Do not use this macro to override options defined by a specific macro variable. For example, do not specify ENCODING=value in this variable because it conflicts with _ODSENCODING. Note: NOGTITLE and NOGFOOTNOTE are appended to the ODS statement as default options. You can override this behavior by specifying GTITLE or GFOOTNOTE for _ODSOPTIONS.

_ODSSTYLE

%STPBEGIN/
%STPEND

Sets the ODS STYLE= option. You can specify any ODS style that is valid on your system.
_ODSSTYLESHEET

%STPBEGIN/
%STPEND

Sets the ODS STYLEHEET= option. To store a generated style sheet in a catalog entry and automatically replay it using the SAS Stored Process Web Application, specify myfile.css (url="myfile.css")
_PROGRAM All

Name of the stored process. The value of _PROGRAM is frequently a path, such as

   /Sales/Southwest/
      Quarterly SummaryIn some cases _PROGRAM can also contain the metadata repository name or use a full URL syntax: 
   //West/Sales/Southwest/
      Quarterly Summary
   sbip://West/Sales/Southwest/
      Quarterly Summary
      (StoredProcess)If your stored process uses the value of _PROGRAM, then it should accept any of these variations.
_QRYSTR Web Clients

Specifies the query string that is contained in the request URL after the path. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_REPLAY Stored Process Server/Web Client A complete URL for use with programs that use the Output Delivery System (ODS). It is composed from the values of _THISSESSION and _TMPCAT. ODS uses this URL to create links that replay stored output when they are loaded by the user's Web browser. This variable is created by the stored process server and is not one of the symbols passed from the SAS Stored Process Web Application. The _REPLAY variable is set only if the _URL variable is passed in from the client or middle tier.
_REPLYTO

%STPBEGIN/
%STPEND

Specifies a designated e-mail address to which package recipients might respond when _RESULT is set to PACKAGE_TO_EMAIL.
_REPOSITORY Web Clients

The metadata repository where the stored process is registered. This is the repository name defined in the InformationService configuration. It is usually the same as the metadata repository name seen in SAS Management Console, but the name might be different in some configurations. This value is normally set in the [webappcfg.html#webappprops params.config] file to define a default repository if the SAS Stored Process Web Application client does not specify a repository in the _PROGRAM variable.

_REQMETH Web Clients

Specifies the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_RESULT All

Specifies the type of client result to be created by the stored process. See [result.html Result Types] for more information. Possible values for this variable are as follows:

STATUS
no output to client.
STREAM
output is streamed to client through _WEBOUT fileref.
PACKAGE_TO_ARCHIVE
package is published to an archive file.
PACKAGE_TO_REQUESTER
package is returned to the client. The package can also be published to an archive file in this case.
PACKAGE_TO_WEBDAV
package is published to a WebDAV server. The _RESULT value is set through the stored process service API and cannot be directly overridden by a client input parameter. The value can be overridden in the stored process program to use these additional values:
PACKAGE_TO_EMAIL
package published to one or more e-mail addresses.
PACKAGE_TO_QUEUE
package published to a message queue.
PACKAGE_TO_SUBSCRIBERS
package published to a subscriber channel. See [stpmacro.html %STPBEGIN and %STPEND] for more information about these options.
_RMTADDR Web Clients

Specifies the Internet Protocol (IP) address of the client that sent the request. For many installations with a firewall between the client and the Web server or servlet container, this value is the firewall address instead of the Web browser client. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_RMTHOST Web Clients

Specifies the fully qualified name of the client that sent the request, or the IP address of the client if the name cannot be determined. For many installations with a firewall between the client and the Web server or servlet container, this value is the firewall name instead of the Web browser client. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_RMTUSER Web Clients

Specifies the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_SESSIONID Stored Process Server A unique identifier for the session. The _SESSIONID variable is created only if a session has been explicitly created.
_SRVNAME Web Clients Specifies the host name of the server that received the request.
_SRVPORT Web Clients Specifies the port number on which this request was received.
_SRVPROT Web Clients

Specifies the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_SRVSOFT Web Clients

Identifies the Web server software. This variable is not set by default but can be enabled in the [webappcfg.html#webappprops params.config] file.

_STPERROR

%STPBEGIN/
%STPEND

Global error variable. Set to 0 if %STPBEGIN and %STPEND complete successfully. Set to a non-zero numeric value if an error occurs.
_STPWORK

%STPBEGIN/
%STPEND

Specifies a temporary working directory to hold files that are published in a package. This variable is set by %STPBEGIN and is not modified by the stored process.
_SUBJECT

%STPBEGIN/
%STPEND

Specifies a subject line when _RESULT is set to PACKAGE_TO_EMAIL.
_THISSESSION Stored Process Server/Web Client A URL composed from the values of _URL and _SESSIONID. This variable is created by the stored process server and is used as the base URL for all URL references to the current session. The _THISSESSION variable is created only if the _URL variable is passed in and a session has been explicitly created.
_TMPCAT Stored Process Server A unique, temporary catalog name. This catalog can be used to store temporary entries to be retrieved later. In socket servers, the _TMPCAT catalog is deleted after a number of minutes specified in the variable _EXPIRE. This variable is created by the stored process server and is not one of the symbols passed from the SAS Stored Process Web Application.
_URL Web Clients Specifies the URL of the Web server middle tier used to access the stored process.
_USERNAME Web Clients Specifies the value for the user name obtained from Web client authentication.
_VERSION Web Clients Specifies the SAS Stored Process Web Application version and build number.
VAR All Reserved. Do not use this variable in a parameter definition.

Vorlage

In Makro Code In Datastep Code
 
 
Meine Werkzeuge