SAS FUNCTIONS_sas k functions-程序员宅基地

技术标签: date  character  intervals  转载sas文章  integer  alignment  statistics  

 

SAS FUNCTIONS

Excerpted from SAS release 8.2 Online Documentation

July, 2004

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

 

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/yugao1986/article/details/6902613

智能推荐

编译器研究之路_未来50年_编译器 研究前沿-程序员宅基地

文章浏览阅读5.8k次,点赞3次,收藏9次。编译器研究之路_未来50年今天,复杂而泛在的软件架构支撑着全球经济,编译器和高级语言正是这些软件的基石。强大而优雅的编译技术在硬件综合等领域同样有着“连城”的价值。毫不夸张地说,与半导体技术一样,编译器和高级语言处于信息时代的核心地位。 本文将展示编译技术过去的辉煌与成就,当前的研究现状,未来的发展方向。我们还将提出四项建议,均来自美国科学基金资助的“编译器研究和教育的_编译器 研究前沿

LDA相关论文汇总_多视角lda算法出自那篇文章-程序员宅基地

文章浏览阅读917次。fromhttp://blog.csdn.net/pirage/article/details/9467547LDA理论David M. Blei, Andrew Y. Ng, and Michael I. Jordan. Latent dirichlet allocation. J. Mach. Learn. Res.,3:993–1022, Ma_多视角lda算法出自那篇文章

微信小程序如何使用Git实现版本管理_小程序 git-程序员宅基地

文章浏览阅读3.5w次,点赞34次,收藏92次。在微信小程序开发的过程中,代码版本管理往往需要使用第三方工具进行管理。虽然微信Web开发工具提供了对Git文件版本状态的提示,但实际的使用体验依然不尽人意。随着微信Web开发工具的更新,最新的内测版本已经支持Git的直接管理,本文将就在微信Web开发工具中使用Git做版本管理做详细介绍。环境准备开发环境:Mac/Windows/Linux均可开发工具:微信Web开发者工具Beta版..._小程序 git

android自定义相机预览尺寸,相机在Android中,如何获得最佳尺寸,预览尺寸,图片尺寸,视图尺寸,图像扭曲...-程序员宅基地

文章浏览阅读200次。混合来自OpenGL和Android相机的视图时图像失真,以便在使用takepicture方法时获取两者的图像.我查了一下,发现相机图片设置为640X480,openGL视图和相机预览都设置为1280×720.所以我将相机图片大小设置为1280×720,结果非常完美.但是我无法在代码中设置大小,因为每个Android设备都会有所不同,并且每个设备都必须从支持的大小列表中选择预览大小和图片大小的设置..._相机预览尺寸改变,怎么重新获取

预加载插件使用_preloadjs vue-程序员宅基地

文章浏览阅读406次。&lt;div class="loader"&gt;&lt;/div&gt; &lt;script src="js/preloadjs.min.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;//引用插件 &lt;script src="js/my_ajax.j_preloadjs vue

Vue——el-table中打开dialog修改数据_el-table内打开el-dialog-程序员宅基地

文章浏览阅读6.2k次,点赞12次,收藏26次。1、表格显示数据<el-table :data="tableData" style="width: 100%"> <el-table-column prop="battery_min" label="最小值" width="180"/> <el-table-colum..._el-table内打开el-dialog

随便推点

预测模型结果校准——Bining_什么是数字bining-程序员宅基地

文章浏览阅读6.8k次。预测模型结果校准——Bining文献[2]中,将训练集中样本按估计值降序排序,均分成k等分;对于落在某个bin里的新样本,属于某个class的概率等于这个bin中这个class的实例所占的比例。[1] 文献[3]中,(1) 将logistic regression模型的输出结果划分成n个等长的bin,使得,定义了第i个bin的区间范围。对于第i个bin的校准值通过下式获得:即计..._什么是数字bining

CSS详解_css格式-程序员宅基地

文章浏览阅读1.4k次。CSS_css格式

powerdesigner 同步mysql 报错_PowerDesigner导出SQL时自动生成注释-程序员宅基地

文章浏览阅读178次。在powerBuilder中新建一个Physical Data Model,在其中新建一个用户表,信息如下图所示: 此时的SQL语句可从其中的Preview视图中得到,如下图所示: 这个时候生成的sql语句是没有注释的,而且sql语句可能也不是适合自己所对应的数据库语言。此时可以通过以下方法来生成注释并且选择所需的数据库语言。1、为sql生成注释,操作如下,我用的是PowerDesigner12...._powerdesigner mysql comment报错

Android模拟器访问本地tomcat服务器下的web应用(webservice),localhost换成10.0.2.2_tomcat修改localhost为10.0.2.2-程序员宅基地

文章浏览阅读2.6k次。安装tomcat后,在浏览器中输入http://localhost:9090/(默认端口为8080,可根据自己情况更改)就能出现如下页面:该页面来自/home/apache-tomcat-7.0.40/webapps/ROOT/index.jsp在一般的JavaWeb程序开发中,我们通常使用localhost或者127.0.0.1来访问本机的Web服务,但是如果_tomcat修改localhost为10.0.2.2

Java变量和运算符总结_java变量和标识运算符实训结果-程序员宅基地

文章浏览阅读199次。1.变量变量指的是程序运行时可变的量. 相当于开辟一块内存空间来保存一些数据.类型则是对变量的种类进行了划分, 不同的类型的变量具有不同的特性1.1 整型变量基本语法格式:int 变量名 = 初始值;代码示例:int num = 10; // 定义一个整型变量 System.out.println(num) ; 注意事项:int 表示变量的类型是一个整型变量名是变..._java变量和标识运算符实训结果

secureCRT查看linux日志换行,SecureCRT查看日志乱码-程序员宅基地

文章浏览阅读493次。Do not go gentle into that good night软件环境:SecureCRT v 5.0.3SecureCRT是在工作中使用的很频繁的工具之一,昨天安装好后发现查看日志文件有乱码; 遂查之;后来发现网上有一堆说什么需要修改服务端i18n配置文件,找了一圈发现文件的位置还不尽相同;后来仔细想后觉得不太靠谱,至少针对我遇到的问题不靠谱;原因如下:a.我看的测试环境是运行了很久..._linux查看日志时换行

推荐文章

热门文章

相关标签