Syntax, LAG function:
LAG<n>(column);
n
specifies the number
of lagged values.
column
specifies a numeric
or character constant, variable, or expression.
|
data work.stockprev; set certadv.Stock6Mon(drop=Close); FirstPrevDay=lag1(Open); SecondPrevDay=lag2(Open); ThirdPrevDay=lag3(Open); run; proc print data=work.stockprev; run;
data work.stockavg; set certadv.stocks(drop=Close); Open1Month=lag1(Open); Open2Month=lag2(Open); Open3MonthAvg=mean(Open,Open1Month,Open2Month); format Open3MonthAvg 8.2; run; proc print data=work.stockavg; run;
Function Name
|
Syntax
|
Function Definition
|
---|---|---|
COUNT
|
COUNT(string, substring <,modifiers>)
|
Counts the number of
times that a specified substring appears within a character string.
|
COUNTC
|
COUNTC(string, character-list <,modifiers>)
|
Counts the number of
characters in a string that appear or do not appear in a list of characters.
|
COUNTW
|
COUNTW(string <,delimiters><,modifiers> )
|
Counts the number of
words in a character string.
|
blank ! $ % & () * +
, - . / ; < ^ |
is used. data work.sloganact; set certadv.slogans; Num24=count(Slogans,'24/7'); NumWord=countw(Slogans); run; proc print data=work.sloganact; run;
Function Name
|
Syntax
|
Function Definition
|
---|---|---|
FIND
|
FIND (string, substring <,
modifiers><,
start-position>);
|
Searches for a specific
substring of characters within a character string.
Returns the starting
position where a substring is found in a string.
|
FINDC
|
FINDC (string, character-list <,
modifiers> <,
start-position>);
|
Searches a string for
any character in a list of characters.
Returns the starting
position where a character from a list of characters is found in a
string.
|
FINDW
|
FINDW (string, word<,
delimiters><,
modifiers> <,
start-position>);
|
Returns the character
position of a word in a string, or returns the number of the word
in a string.
|
data work.sloganact;
set certadv.slogans;
Num24=count(Slogans,'24/7');
NumWord=countw(Slogans);
FindWord24=findw(Slogans,'24/7',' ','e');
run;
proc print data=work.sloganact;
run;