Welcome To SAS

Index Document SAS   SAS Questions SAS Main Frames Example. Data Warehousing C Programs Trouble Shooting  Favorite Sites Informatica  Blog

SAS (Statistical Analysis System)

SAS began its company life in 1976 and was called SAS Institute because the name SAS (by itself) was already taken by another incorporated company. SAS (pronounced sass) was an acronym for "Statistical Analysis System."

SAS is the market leader in providing a new generation of business intelligence software and services that create true enterprise intelligence. SAS solutions are used at more than 39,000 sites -- including 90% of the Fortune 500 -- to develop more profitable relationships with customers and suppliers; to enable better, more accurate and informed decisions; and to drive organizations forward. SAS is the only vendor that completely integrates leading data warehousing, analytics and traditional BI applications to create intelligence from massive amounts of data. For more than 25 years, SAS has been giving customers around the world

Listing Site Updates

Getting Started Using SAS

 

What is SAS

Give some Sas Functions


What is SAS?

 

 

SAS is an application which offers an array of tools that

users can use to uncover and analyze information. SAS

can produce simple reports to complicated Web input

forms; it has data warehousing capabilities and

analytical applications. SAS has users in government,

education, utility companies, business and financial

management, and the healthcare industry.

SAS is offered over numerous platforms and offers a is offered over numerous platforms and offers a multitude of products. In our office we primarily use

Base SAS and SAS Graph in version 9.


 

CEIL Function



Returns the smallest integer that is greater than or equal to the argument, fuzzed to avoid unexpected floating-point results
  Ex: 
var1=2.1;
a=ceil(var1);
put a;
 
 
3
b=ceil(-2.4);
put b;
-2
 

CEXIST Function

 Verifies the existence of a SAS catalog or SAS catalog entry 

Examples

 

Example 1: Verifying the Existence of an Entry in a Catalog

This example verifies the existence of the entry X.PROGRAM in LIB.CAT1:

data _null_;
   if cexist("lib.cat1.x.program") then
   put "Entry X.PROGRAM exists";
run;
 

Example 2: Determining if a Catalog Can Be Opened for Update

This example tests whether the catalog LIB.CAT1 exists and can be opened for update. If the catalog does not exist, a message is written to the SAS log. Note that in a macro statement you do not enclose character strings in quotation marks.

%if %sysfunc(cexist(lib.cat1,u)) %then
   %put The catalog LIB.CAT1 exists and can be opened for update.;
%else
   %put %sysfunc(sysmsg());
 

CHOOSEC Function



Returns a character value that represents the results of choosing from a list of arguments
 
Ex:
 
data temp;
input id name $ name2 $;
cards;
1 sekar ram
2 ram sekar
3 rahul dravid
;
run;
 
data _null_;
set temp;
x=choosec(1,name,name2);
put x=;
run;
 
output:
 
x=sekar
x=ram
x=rahul
 
data _null_;
   Fruit=choosec(1,'apple','orange','pear','fig');
   Color=choosec(3,'red','blue','green','yellow');
   Planet=choosec(2,'Mars','Mercury','Uranus');
   Sport=choosec(-3,'soccer','baseball','gymnastics','skiing');
   put Fruit= Color= Planet= Sport=;
run;

SAS writes the following line to the log:

Fruit=apple Color=green Planet=Mercury Sport=baseball

CHOOSEN Function



Returns a numeric value that represents the results of choosing from a list of arguments

Syntax

 

CHOOSEN (index-expression, selection-1 <,...selection-n>)

 

Arguments

index-expression

specifies a numeric expression.

selection

specifies a numeric expression that is returned.


 

Details

The CHOOSEN function uses the value of index-expression to select from the arguments that follow. For example, if index-expression is 3, CHOOSEN returns the value of selection-3. If the first argument is negative, the function counts backwards from the list of arguments, and returns that value.


 

Comparisons

The CHOOSEN function is similar to the CHOOSEC function except that CHOOSEN returns a numeric value while CHOOSEC returns a character value.


 

Examples

The following example shows how CHOOSEN chooses from a series of values:

data _null_;
   ItemNumber=choosen(5,100,50,3784,498,679);
   Rank=choosen(-2,1,2,3,4,5);
   Score=choosen(3,193,627,33,290,5);
   Value=choosen(-5,-37,82985,-991,3,1014,-325,3,54,-618);
   put ItemNumber= Rank= Score= Value=; 
run;

SAS writes the following line to the log:

ItemNumber=679 Rank=4 Score=33 Value=1014
 
 

COMPARE Function



Returns the position of the leftmost character by which two strings differ, or returns 0 if there is no difference
 

Syntax

 

COMPARE(string-1, string-2<,modifiers>)

 

Arguments

string-1

specifies a character constant, variable, or expression.

string-2

specifies a character constant, variable, or expression.

modifiers

specifies a character string that can modify the action of the COMPARE function. You can use one or more of the following characters as a valid modifier:

i or I

ignores the case in string-1 and string-2.

l or L

removes leading blanks in string-1 and string-2 before comparing the values.

n or N

removes quotation marks from any argument that is an n-literal and ignores the case of string-1 and string-2.

: (colon)

truncates the longer of string-1 or string-2 to the length of the shorter string, or to one, whichever is greater. If you do not specify this modifier, the shorter string is padded with blanks to the same length as the longer string.

 

TIP:

COMPARE ignores blanks that are used as modifiers.
 

 

Details

The order in which the modifiers appear in the COMPARE function is relevant.

·    "LN" first removes leading blanks from each string, and then removes quotation marks from n-literals.

·    "NL" first removes quotation marks from n-literals, and then removes leading blanks from each string.

In the COMPARE function, if string-1 and string-2 do not differ, COMPARE returns a value of zero. If the arguments differ

·    the sign of the result is negative if string-1 precedes string-2 in a sort sequence, and positive if string-1 follows string-2 in a sort sequence

·    the magnitude of the result is equal to the position of the leftmost character at which the strings differ.

 
 
Ex:
options pageno=1 nodate ls=80 ps=60;
 
data test;
   infile datalines missover;
   input string1 $char8. string2 $char8. modifiers $char8.;
   result=compare(string1, string2, modifiers);
   datalines;
1234567812345678
123     abc
abc     abx
xyz     abcdef
aBc     abc
aBc     AbC     i
   abc  abc
   abc  abc     l
 abc       abx
 abc       abx  l 
ABC     'abc'n
ABC     'abc'n  n 
 '$12'n $12     n
 '$12'n $12     nl
 '$12'n $12     ln
;
 
proc print data=test;
run;

The following output shows

   

COMPBL Function



Removes multiple blanks from a character string and single blanks. 

Syntax

 

COMPBL(source)

 

Arguments

source

specifies the source string to compress.


 

Details

If the COMPBL function returns a value to a variable that has not yet been assigned a length, by default the variable length is determined by the length of the first argument.

The COMPBL function removes multiple blanks in a character string by translating each occurrence of two or more consecutive blanks into a single blank.

The default length of the value that COMPBL returns is the same as the length of the argument.


 

Comparisons

The COMPRESS function removes every occurrence of the specific character from a string. If you specify a blank as the character to remove from the source string, the COMPRESS function is similar to the COMPBL function. However, the COMPRESS function removes all blanks from the source string, while the COMPBL function compresses multiple blanks to a single blank and has no affect on a single blank.

 
 
 

CAT Function



Concatenates character strings without removing leading or trailing blanks
 Ex: 

CAT(OF X1-X4)
X1||X2||X3||X4

  

CATS Function



Concatenates character strings and removes leading and trailing blanks
 Ex: 

CATS(OF X1-X4)
TRIM(LEFT(X1))||TRIM(LEFT(X2))||TRIM(LEFT(X3))||
TRIM(LEFT(X4))

  

CATX Function



Concatenates character strings, removes leading and trailing blanks, and inserts separators
  

CATX(SP, OF X1-X4)
TRIM(LEFT(X1))||SP||TRIM(LEFT(X2))||SP||
TRIM(LEFT(X3))||SP||TRIM(LEFT(X4))

  

CATT Function



Concatenates character strings and removes trailing blanks
 

CATT(OF X1-X4)
TRIM(X1)||TRIM(X2)||TRIM(X3)||TRIM(X4)

  

COMPOUND Function



Returns compound interest parameters
 

Ex: future=compound(2000,.,0.09/12,30);

 

COUNT Function



Counts the number of times that a specific sub string of characters appears within a character string that you specify
  Counts only the specific string mentioned in string. COUNT(string,substring<,modifiers>)     Modifiers

is a character constant, variable, or expression that specifies one or more modifiers. The following modifiers can be in uppercase or lowercase:

i

ignores character case during the count. If this modifier is not specified, COUNT only counts character substrings with the same case as the characters in substring.

t

trims trailing blanks from string and substring.

   

Ex:

 

SAS Statements

Results
xyz='This is a thistle? Yes, this is a thistle.';
howmanythis=count(xyz,'this');
put howmanythis;
 
3
xyz='This is a thistle? Yes, this is a thistle.';
howmanyis=count(xyz,'is');
put howmanyis;
 
6
howmanythis_i=count('This is a thistle? Yes, this is a thistle.'
   ,'this','i');
put howmanythis_i;
 
4
variable1='This is a thistle? Yes, this is a thistle.';
variable2='is ';
variable3='i';
howmanyis_i=count(variable1,variable2,variable3);
put howmanyis_i;
 
 
 
4
expression1='This is a thistle? '||'Yes, this is a thistle.';
expression2=kscan('This is',2)||'     ';
expression3=compress('i     '||'     t');
howmanyis_it=count(expression1,expression2,expression3);
put howmanyis_it;
 
 
 
6
   

COUNTC Function



Counts the number of specific characters that either appear or do not appear within a character string that you specify
 Understanding: It counts the each character occurrence from the specified string. 

 

Syntax

 

COUNTC(string,characters<,modifiers>)

  modifiers

is a character constant, variable, or expression that specifies one or more modifiers. The following modifiers can be in uppercase or lowercase:

i

ignores character case during the count. If this modifier is not specified, COUNTC only counts characters with the same case as the characters in characters.

o

processes characters and modifiers only once, at the first call to this instance of COUNTC. Consequently, if you change the value of characters or modifiers in subsequent calls, the change is ignored by COUNTC.

t

trims trailing blanks from string and characters.

v

counts only the characters that do not appear in characters.

  

CUROBS Function



Returns the observation number of the current observation
 

Syntax

 

CUROBS(data-set-id)

Arguments

data-set-id  

specifies the data set identifier that the OPEN function returns.

 

Examples

This example uses the FETCHOBS function to fetch the tenth observation in the data set MYDATA. The value of OBSNUM returned by CUROBS is 10.

%let dsid=%sysfunc(open(mydata,i));
%let rc=%sysfunc(fetchobs(&dsid,10));
%let obsnum=%sysfunc(curobs(&dsid));
  

DATDIF Function



Returns the number of days between two dates 

Syntax

 

DATDIF(sdate,edate,basis)

 

Arguments

sdate

specifies a SAS date value that identifies the starting date.

edate

specifies a SAS date value that identifies the ending date.

basis

identifies a character constant or variable that describes how SAS calculates the date difference. The following character strings are valid:

'30/360'

specifies a 30 day month and a 360 day year. Each month is considered to have 30 days, and each year 360 days, regardless of the actual number of days in each month or year.

Alias:

'360'
Tip:If either date falls at the end of a month, SAS treats the date as if it were the last day of a 30-day month.
'ACT/ACT'

uses the actual number of days between dates.

Examples

In the following example, DATDIF returns the actual number of days between two dates, and the number of days based on a 30-month and 360-day year.

data _null;
   sdate='16oct78'd;
   edate='16feb96'd;
   actual=datdif(sdate, edate, 'act/act');
   days360=datdif(sdate, edate, '30/360');
   put actual= days360=;
run;

SAS Statements

Results
put actual=;
6332
put days360=;
6240

DATE Function



Returns the current date as a SAS date value

Category:

Date and Time
Alias:TODAY
 

DATEJUL Function:

 Converts a Julian date to a SAS date value

Syntax:

DATEJUL(julian-date)
 

Arguments

julian-date

specifies a SAS numeric expression that represents a Julian date. A Julian date in SAS is a date in the form yyddd or yyyyddd, where yy or yyyy is a two-digit or four-digit integer that represents the year and ddd is the number of the day of the year. The value of ddd must be between 1 and 365 (or 366 for a leap year).

 
Xstart=datejul(94365); // 94 and 365th day.
put Xstart / Xstart date9.;
 
Output is:
 
12783
31DEC1994
 

DATEPART Function



Extracts the date from a SAS date time value.
 Syntax:
DATEPART (datetime)
 
Examples
 

The following SAS statements produce this result:

conn='01feb94:8:45'dt;
servdate=datepart(conn);
put servdate worddate.;
 
o/p:
 
February 1, 1994
 
DATETIME Function:
 
Returns the current date and time of day as a SAS datetime value
 

Examples

This example returns a SAS value that represents the number of seconds between January 1, 1960 and the current time:

when=datetime();
put when=;
o/p is  current date time.
 

DAY Function



Returns the day of the month from a SAS date value

Syntax

DAY(date)

now='05may97'd;

d=day(now);

put d;

 

o/p is :5

 DCLOSE Function: Closes a directory that was opened by the DOPEN function 

Syntax

DCLOSE (directory-id)

 

Details

DCLOSE returns 0 if the operation was successful, 0 if it was not successful. The DCLOSE function closes a directory that was previously opened by the DOPEN function. DCLOSE also closes any open members.

This example uses the DCLOSE function within a DATA step:

%let filrf=MYDIR;
data _null_;
  rc=filename("&filrf","physical-filename");
  if fileref("&filrf") = 0 then
     do;
           /* Open the directory. */
        did=dopen("&filrf");                
           /* Get the member count. */
        memcount=dnum(did);
        put memcount "members in &filrf";
           /* Close the directory. */
        rc=dclose(did);
     end;
  else put "Invalid FILEREF";
run;
 
 
 
 
 
 
 
 
DCREATE Function:
 
Creates an external directory.

Syntax

new-directory=DCREATE(directory-name<,parent-directory>)

Argumentsnew-directory

contains the complete pathname of the new directory, or contains an empty string if the directory cannot be created.

directory-name

specifies the name of the directory to create. This value cannot include a pathname.

parent-directory

contains the complete pathname of the directory in which to create the new directory. If you do not supply a value for parent-directory, then the current directory is the parent directory.

 Example:

To create a new directory in the Windows operating environment, using the name that is stored in the variable DirectoryName, follow this form:

NewDirectory=dcreate(DirectoryName,'d:\testdir\');
 
DHMS Function
 ·         Returns the date time value from date, hour, minute, and second. Syntax:

DHMS (date, hour, minute, second)

Ex: dtid=dhms('01jan03'd,15,30,15);
put dtid;
put dtid datetime.;
O/p: 1357054215
01JAN03:15:30:15

DIF Function

Returns differences between the argument and its nth lag
 

Syntax

DIF<n>(argument)
 
Arguments
n

specifies the number of lags.

Argument
 

is numeric.

This example demonstrates the difference between the LAG and DIF functions.

data two;
   input X @@;
   Z=lag(x);
   D=dif(x);
   datalines;
1 2 6 4 7
;
proc print data=two;
run;
 
o/p
 
                                                        Obs    X    Z     D
 
                                                         1     1    .     .
                                                         2     2    1     1
                                                         3     6    2     4
                                                         4     4    6    -2
                                                         5     7    4     3
data two;
   input X @@;
   Z=lag2(x);
   D=dif2(x);
   datalines;
1 2 6 4 7
;
proc print data=two;
run;
 
o/p:
 
                                             Obs    X    Z    D
 
                                                          1     1    .    .
                                                          2     2    .    .
                                                          3     6    1    5
                                                          4     4    2    2
                                                          5     7    6    1
 
 
DIM Function 
 
Returns the number of elements in an array
 
Syntax

DIM<n>(array-name)

DIM(array-name,bound-n)

 

Example 1: One-dimensional Array

In this example, DIM returns a value of 5. Therefore, SAS repeats the statements in the DO loop five times.

   array big{5} weight sex height state city;
   do i=1 to dim(big);
     more SAS statements;
   end;
 

Example 2: Multidimensional Array

This example shows two ways of specifying the DIM function for multidimensional arrays. Both methods return the same value for DIM, as shown in the table that follows the SAS code example.

   array mult{5,10,2} mult1-mult100;

Syntax

Alternative SyntaxValue
DIM(MULT)DIM(MULT,1)5
DIM2(MULT)DIM(MULT,2)10
DIM3(MULT)DIM(MULT,3)2
 

Arithmetic Functions

ABS(argument)

returns absolute value

DIM<n>(array-name)

returns the number of elements in a one-dimensional array or the number of elements in a specified dimension of a multidimensional array.

n specifies the dimension, in a multidimensional array, for which you want to know the the number of elements.

DIM(array-name,bound-n)

returns the number of elements in a one-dimensional array or the number of elements in the specified dimension of a multidimensional array

bound-n specifies the dimension in a multidimensional array, for which you want to know the number of elements.

HBOUND<n>(array-name)

returns the upper bound of an array

HBOUND(array-name,bound-n)

returns the upper bound of an array

LBOUND<n>(array-name)

returns the lower bound of an array

LBOUND(array-name,bound-n)

returns the lower bound of an array

MAX(argument,argument, ...)

returns the largest value of the numeric arguments

MIN(argument,argument, ...)

returns the smallest value of the numeric arguments

MOD(argument-1, argument-2)

returns the remainder

SIGN(argument)

returns the sign of a value or 0

SQRT(argument)

returns the square root

 

Character Functions

BYTE(n)

returns one character in the ASCII or EBCDIC collating sequence where nis an integer representing a specific ASCII or EBCDIC character

COLLATE(start-position<,end-position>) | (start-position<,,length>)

returns an ASCII or EBCDIC collating sequence character string

COMPBL(source)

removes multiple blanks between words in a character string

COMPRESS(source<,characters-to-remove>)

removes specific characters from a character string

DEQUOTE(argument)

removes quotation marks from a character value

INDEX(source,excerpt)

searches the source for the character string specified by the excerpt

INDEXC(source,excerpt-1<, ... excerpt-n>)

searches the source for any character present in the excerpt

INDEXW(source,excerpt)

searches the source for a specified pattern as a word

LEFT(argument)

left-aligns a SAS character string

LENGTH(argument)

returns the length of an argument

LOWCASE(argument)

converts all letters in an argument to lowercase

QUOTE(argument)

adds double quotation marks to a character value

RANK(x)

returns the position of a character in the ASCII or EBCDIC collating sequence

REPEAT(argument,n)

repeats a character expression

REVERSE(argument)

reverses a character expression

RIGHT(argument)

right-aligns a character expression

SCAN(argument,n<,delimiters>)

returns a given word from a character expression

SOUNDEX(argument)

encodes a string to facilitate searching

SUBSTR(argument,position<,n>)=characters-to-replace

replaces character value contents

var=SUBSTR(argument,position<,n>)

extracts a substring from an argument. (var is any valid SAS variable name.)

TRANSLATE(source,to-1,from-1<,...to-n,from-n>)

replaces specific characters in a character expression

TRANWRD(source,target,replacement)

replaces or removes all occurrences of a word in a character string

TRIM(argument)

removes trailing blanks from character expression and returns one blank if the expression is missing

TRIMN(argument)

removes trailing blanks from character expressions and returns a null string if the expression is missing

UPCASE(argument)

converts all letters in an argument to uppercase

VERIFY(source,excerpt-1<,...excerpt-n)

returns the position of the first character unique to an expression

 

Date and Time Functions

DATDIF(sdate,edate,basis)

returns the number of days between two dates

DATE()

returns the current date as a SAS date value

DATEJUL(julian-date)

converts a Julian date to a SAS date value

DATEPART(datetime)

extracts the date from a SAS datetime value

DATETIME()

returns the current date and time of day

DAY(date)

returns the day of the month from a SAS date value

DHMS(date,hour,minute,second)

returns a SAS datetime value from date, hour, minute, and second

HMS(hour,minute,second)

returns a SAS time value from hour, minute, and second

HOUR(<time | datetime>)

returns the hour from a SAS time or datetime value

INTCK('interval',from,to)

returns the number of time intervals in a given time span

INTNX('interval',start-from,increment<,'alignment'>)

advances a date, time, or datetime value by a given interval, and returns a date, time, or datetime value

JULDATE(date)

returns the Julian date from a SAS date value

MDY(month,day,year)

returns a SAS date value from month, day, and year values

MINUTE(time | datetime)

returns the minute from a SAS time or datetime value

MONTH(date)

returns the month from a SAS date value

QTR(date)

returns the quarter of the year from a SAS date value

SECOND(time | datetime)

returns the second from a SAS time or datetime value

TIME()

returns the current time of day

TIMEPART(datetime)

extracts a time value from a SAS datetime value

TODAY()

returns the current date as a SAS date value

WEEKDAY(date)

returns the day of the week from a SAS date value

YEAR(date)

returns the year from a SAS date value

YRDIF(sdate,edate,basis)

returns the difference in years between two dates

YYQ(year,quarter)

returns a SAS date value from the year and quarter

 

Mathematical Functions

AIRY(x)

returns the value of the AIRY function

DAIRY(x)

returns the derivative of the AIRY function

DIGAMMA(argument)

returns the value of the DIGAMMA function

ERF(argument)

returns the value of the (normal) error function

ERFC(argument)

returns the value of the (normal) error function

EXP(argument)

returns the value of the exponential function

GAMMA(argument)

returns the value of the GAMMA function

IBESSEL(nu,x,kode)

returns the value of the modified bessel function

JBESSEL(nu,x)

returns the value of the bessel function

LGAMMA(argument)

returns the natural logarithm of the GAMMA function

LOG(argument)

returns the natural (base e) logarithm

LOG2(argument)

returns the logarithm to the base 2

LOG10(argument)

returns the logarithm to the base 10

TRIGAMMA(argument)

returns the value of the TRIGAMMA function

 

Noncentrality Functions

CNONCT(x,df,prob)

returns the noncentrality parameter from a chi-squared distribution

FNONCT(x,ndf,ddf,prob)

returns the value of the noncentrality parameter of an F distribution

TNONCT(x,df,prob)

returns the value of the noncentrality parameter from the student's t distribution

Probability and Density Functions

CDF('dist',quantile,parm-1,...,parm-k)

computes cumulative distribution functions

LOGPDF|LOGPMF('dist',quantile,parm-1,...,parm-k)

computes the logarithm of a probability density (mass) function. The two functions are identical.

LOGSDF('dist',quantile,parm-1,...,parm-k)

computes the logarithm of a survival function

PDF|PMF('dist',quantile,parm-1,...,parm-k)

computes probability density (mass) functions

POISSON(m,n)

returns the probability from a POISSON distribution

PROBBETA(x,a,b)

returns the probability from a beta distribution

PROBBNML(p,n,m)

returns the probability from a binomial distribution

PROBCHI(x,df<,nc>)

returns the probability from a chi-squared distribution

PROBF(x,ndf,ddf<,nc>)

returns the probability from an F distribution

PROBGAM(x,a)

returns the probability from a gamma distribution

PROBHYPR(N,K,n,x<,r>)

returns the probability from a hypergeometric distribution

PROBMC

probabilities and critical values (quantiles) from various distributions for multiple comparisons of the means of several groups.

PROBNEGB(p,n,m)

returns the probability from a negative binomial distribution

PROBBNRM(x,y,r)

standardized bivariate normal distribution

PROBNORM(x)

returns the probability from the standard normal distribution

PROBT(x,df<,nc>)

returns the probability from a Student's t distribution

SDF('dist',quantile,parm-1,...,parm-k)

computes a survival function

 

Quantile Functions

BETAINV(p,a,b)

returns a quantile from the beta distribution

CINV(p,df<,nc>)

returns a quantile from the chi-squared distribution

FINV(p,ndf,ddf<,nc>)

returns a quantile from the F distribution

GAMINV(p,a)

returns a quantile from the gamma distribution

PROBIT(p)

returns a quantile from the standard normal distribution

TINV(p,df<,nc>)

returns a quantile from the t distribution

 

Sample Statistics Functions

CSS(argument,argument,...)

returns the corrected sum of squares

CV(argument,argument,...)

returns the coefficient of variation

KURTOSIS(argument,argument,...)

returns the kurtosis (or 4th moment)

MAX(argument,argument, ...)

returns the largest value

MIN(argument,argument, ...)

returns the smallest value

MEAN(argument,argument, ...)

returns the arithmetic mean (average)

MISSING(numeric-expression | character-expression)

returns a numeric result that indicates whether the argument contains a missing value

N(argument,argument, ....)

returns the number of nonmissing values

NMISS(argument,argument, ...)

returns the number of missing values

ORDINAL(count,argument,argument,...)

returns the largest value of a part of a list

RANGE(argument,argument,...)

returns the range of values

SKEWNESS(argument,argument,argument,...)

returns the skewness

STD(argument,argument,...)

returns the standard deviation

STDERR(argument,argument,...)

returns the standard error of the mean

SUM(argument,argument,...)

returns the sum

USS(argument,argument,...)

returns the uncorrected sum of squares

VAR(argument,argument,...)

returns the variance

 

State and ZIP Code Functions

FIPNAME(expression)

converts FIPS codes to uppercase state names

FIPNAMEL(expression)

converts FIPS codes to mixed case state names

FIPSTATE(expression)

converts FIPS codes to two-character postal codes

STFIPS(postal-code)

converts state postal codes to FIPS state codes

STNAME(postal-code)

converts state postal codes to uppercase state names

Tip:

For Version 6, the maximum length of the value that is returned is 200 characters. For Version 7 and beyond, the maximum length is 20 characters.

STNAMEL(postal-code)

converts state postal codes to mixed case state names

Tip:

For Version 6, the maximum length of the value that is returned is 200 characters. For Version 7 and beyond, the maximum length is 20 characters.

ZIPFIPS(zip-code)

converts ZIP codes to FIPS state codes

ZIPNAME(zip-code)

converts ZIP codes to uppercase state names

ZIPNAMEL(zip-code)

converts ZIP codes to mixed case state names

ZIPSTATE(zip-code)

converts ZIP codes to state postal codes

 

Trigonometric and Hyperbolic Functions

ARCOS(argument)

returns the arccosine

ARSIN(argument)

returns the arcsine

ATAN(argument)

returns the arctangent

COS(argument)

returns the cosine

COSH(argument)

returns the hyperbolic cosine

SIN(argument)

returns the sine

SINH(argument)

returns the hyperbolic sine

TAN(argument)

returns the tangent

TANH(argument)

returns the hyperbolic tangent

 

Truncation Functions

CEIL(argument)

returns the smallest integer that is greater than or equal to the argument

FLOOR(argument)

returns the largest integer that is less than or equal to the argument

FUZZ(argument)

returns the nearest integer if the argument is within 1E-12

INT(argument)

returns the integer value

ROUND(argument,round-off-unit)

rounds to the nearest round-off unit

TRUNC(number, length)

truncates a numeric value to a specified length

 

Variable Information Functions

GETVARC(data-set-id,var-num)

returns the value of a SAS data set character variable

GETVARN(data-set-id,var-num)

returns the value of a SAS data set numeric variable

VARFMT(data-set-id,var-num)

returns the format assigned to a SAS data set variable

VARINFMT(data-set-id,var-num)

returns the informat assigned to a SAS data set variable

VARLABEL(data-set-id,var-num)

returns the label assigned to a SAS data set variable

VARLEN(data-set-id,var-num)

returns the length of a SAS data set variable

VARNAME(data-set-id,var-num)

returns the name of a SAS data set variable

VARNUM(data-set-id,var-name)

returns the number of a SAS data set variable's position in a SAS data set

VARRAY(name)

returns a value that indicates whether the specified name is an array

VARRAYX(expression)

returns a value that indicates whether the value of the specified argument is an array

VARTYPE(data-set-id,var-num)

returns the data type of a SAS data set variable

VFORMAT(var)

returns the format associated with the given variable

VFORMATD(var)

returns the format decimal value associated with the given variable

VFORMATDX(expression)

returns the format decimal value associated with the value of the specified argument

VFORMATN(var)

returns the format name associated with the given variable

VFORMATNX(expression)

returns the format name associated with the value of the specified argument

VFORMATW(var)

returns the format width associated with the given variable

VFORMATWX(expression)

returns the format width associated with the value of the specified argument

VFORMATX(expression)

returns the format associated with the value of the specified argument

VINARRAY(var)

returns a value that indicates whether the given variable is a member of an array

VINARRAYX(expression)

returns a value that indicates whether the value of the specified argument is a member of an array

VINFORMAT(var)

returns the informat associated with the given variable

VINFORMATD(var)

returns the informat decimal value associated with the given variable

VINFORMATDX(expression)

returns the informat decimal value associated with the value of the specified argument

VINFORMATN(var)

returns the informat name associated with the given variable

VINFORMATNX(expression)

returns the informat name associated with the value of the specified argument

VINFORMATW(var)

returns the informat width associated with the given variable

VINFORMATWX(expression)

returns the informat width associated with the value of the specified argument

VINFORMATX(expression)

returns the informat associated with the value of the specified argument

VLABEL(var)

returns the label associated with the given variable

VLABELX(expression)

returns the variable label for the value of a specified argument

VLENGTH(var)

returns the compile-time (allocated) size of the given variable

VLENGTHX(expression)

returns the compile-time (allocated) size for the value of the specified argument

VNAME(var)

returns the name of the given variable

VNAMEX(expression)

validates the value of the specified argument as a variable name

VTYPE(var)

returns the type (character or numeric) of the given variable

VTYPEX(expression)

returns the type (character or numeric) for the value of the specified argument

  

 

 http://support.sas.com/techsup/sample/testbase.html

http://ftp.sas.com/techsup/download/sample/samp_lib/hostsampBase_SAS_Sample_Programs.html

http://www.ats.ucla.edu/stat/sas/seminars/SAS_arrays/movies/sas_array2.html

http://www.adras.com/deleting-macro-variables-with-the-SYMDEL-statement.t1385-199.html

http://www.utexas.edu/its/rc/answers/sas/sas1.html

http://www.dmreview.com/article_sub.cfm?articleId=1009157

http://www.ciser.cornell.edu/computing/SASQA.shtml

http://www.cpc.unc.edu/services/computer/presentations/sasclass99/keepdrop.html

http://support.sas.com/techsup/sample/base_samples.html

http://www.ats.ucla.edu/stat/sas/modules/labels.htm

http://www.csc.fi/cschelp/sovellukset/stat/sas/sasdoc/sashtml/ets/chap2/index.htm

http://www.tau.ac.il/cc/pages/docs/sas8/macro/zenid-61.htm

http://www.sconsig.com/

http://support.sas.com/techsup/tnote/tnote_base.html

http://www.stanford.edu/class/hrp223/

http://www.lexjansen.com/

http://help.pop.psu.edu/

http://www.prochelp.com/findanswer.htm

http://www.columbia.edu/acis/eds/stat_pak/sas/moving.sas.html

http://www.cpc.unc.edu/services/computer/presentations/sasclass99/merge.html

http://www.sas.com/technologies/architecture/

http://www.ats.ucla.edu/stat/sas/modules/syntax.htm

http://support.sas.com/documentation/onlinedoc/code.samples.html

http://www.lexjansen.com/cgi-bin/sugi.php?x=22&s=sugi#ad

http://www.lexjansen.com/cgi-bin/sugi.php?x=26&s=sugi

http://www.columbia.edu/acis/eds/stat_pak/sas/sas-write.html#readraw

http://support.sas.com/events/sasglobalforum/about/faq.html

http://books.google.com/books?vid=ISBN1590473299&id=pthP0v-jh6cC&pg=PA15&lpg=PA15&dq=SAS+free+books&sig=XQxb-C3gT9YYLBKjsukpd33RmIY

 

http://www.ats.ucla.edu/stat/SAS/library/SASTranMan_os.html

Statistics

http://wiki.binghamton.edu/index.php/Getting_Started_with_SAS/Part_4