SAS array

Paper 242-30

Arrays Made Easy: An Introduction to Arrays and Array Processing Steve First and Teresa Schudrowitz, Systems Seminar Consultants, Inc., Madison, WI ABSTRACT

Many programmers often find the thought of using arrays in their programs to be a daunting task, and as a result they often shy away from arrays in their code in favor of better-understood, but more complex solutions. A SAS array is a convenient way of temporarily identifying a group of variables for processing within a data step. Once the array has been defined the programmer is now able to perform the same tasks for a series of related variables, the array elements. Once the basics of array processing are understood arrays are a simple solution to many program scenarios.

Throughout this paper we will review the following array topics:

1) Why do we need arrays?

2) Basic array concepts

a) Definition

b) Elements

c) Syntax

d) Rules

3) Using array indexes

4) One dimension arrays

5) Multi-dimension arrays

6) Temporary arrays

7) Explicit vs. implicit subscripting

8) Sorting arrays

9) When to use arrays

10) Common errors and misunderstandings

INTRODUCTION

Most mathematical and computer languages have some notation for repeating or other related values. These repeated structures are often called a matrix, a vector, a dimension, a table, or in the SAS data step, this structure is called an array. While every memory address in a computer is an array of sorts, the SAS definition is a group of related variables that are already defined in a data step. Some differences between SAS arrays and those of other languages are that SAS array elements don’t need to be contiguous, the same length, or even related at all. All elements must be character or numeric.

WHY DO WE NEED ARRAYS?

The use of arrays may allow us to simplify our processing. We can use arrays to help read and analyze repetitive data with a minimum of coding.

An array and a loop can make the program smaller. For example, suppose we have a file where each record contains 24 values with the temperatures for each hour of the day. These temperatures are in Fahrenheit and we need to convert them to 24 Celsius values. Without arrays we need to repeat the same calculation for all 24 temperature variables:

data;

input etc.

celsius_temp1 = 5/9(temp1 – 32);

celsius_temp2 = 5/9(temp2 – 32);

. . .

celsius_temp24 = 5/9(temp24 – 32);

run;

An alternative is to define arrays and use a loop to process the calculation for all variables:

data;

input etc.

array temperature_array {24} temp1-temp24;

array celsius_array {24} celsius_temp1-celsius_temp24;

do i = 1 to 24;

celsius_array{i} = 5/9(temperature_array{i} – 32);

end;

run;

While in this example there are only 24 elements in each array, it would work just as well with hundreds of elements. In addition to simplifying the calculations, by defining arrays for the temperature values we could also have used them in the input statement to simplify the input process. It should also be noted, while TEMP1 is equivalent to the first element, TEMP2 to the second etc., the variables do not need to be named consecutively. The array would work just as well with non-consecutive variable names.

array sample_array {5} x a i r d;

In this example, the variable x is equivalent to the first element, a to the second etc.

Arrays may also be used to provide table lookups. For instance, we have different percentage rates that will be applied to a representative’s sales amounts to determine their commission. The percentage amount may be stored within an array structure, and then the array could provide a location to look up the appropriate percentage for inclusion in the commission calculation.

BASIC ARRAY CONCEPTS

Arrays within SAS are different than arrays in other languages. SAS arrays are another way to temporarily group and refer to SAS variables. A SAS array is not a new data structure, the array name is not a variable, and arrays do not define additional variables. Rather, a SAS array provides a different name to reference a group of variables.

The ARRAY statement defines variables to be processed as a group. The variables referenced by the array are called elements. Once an array is defined, the array name and an index reference the elements of the array. Since similar processing is generally completed on the array elements, references to the array are usually found within DO groups.

ARRAY STATEMENT

The statement used to define an array is the ARRAY statement.

array array-name {n} <$> array-elements <(initial-values)>;

The ARRAY statement is a compiler statement within the data step. In addition, the array elements cannot be used in compiler statements such as DROP or KEEP. An array must be defined within the data step prior to being referenced and if an array is referenced without first being defined, an error will occur. Defining an array within one data step and referencing the array within another data step will also cause errors, because arrays exist only for the duration of the data step in which they are defined. Therefore, it is necessary to define an array within every data step where the array will be referenced

The ARRAY statements provides the following information about the SAS array:

?array-name – Any valid SAS name

?n – Number of elements within the array

?$ - Indicates the elements within the array are character type variables

?length – A common length for the array elements

?elements – List of SAS variables to be part of the array

?initial values – Provides the initial values for each of the array elements

The array name will be used as part of the array reference when the array elements are used in processing. The name must follow the same rules as variable names, therefore, any valid SAS name is a valid array name. When naming an array it is best to avoid using an array name that is the same as a function name to avoid confusion. While parentheses or square brackets can be used when referencing array elements, the braces {} are used most often since they are not used in other SAS statements. SAS does place one restriction on the name of the array. The array name may not be the same name as any variable on the SAS data set.

The elements for an array must be all numeric or all character. When the elements are character it is necessary to indicate this at the time the array is defined by including the dollar sign ($) on the array statement after the reference to the number of elements. If the dollar sign is not included on the array statement, the array is assumed to be numeric.

When all numeric or all character variables in the data set are to be elements within the array, there are several special variables that may used instead of listing the individual variables as elements. The special variables are: _NUMERIC_ - when all the numeric variables will be used as elements

_CHARACTER_ - when all the character variables will be used as elements

_ALL_ - when all variables on the data set will be used as elements and the variables are all

the same type

N is the array subscript in the array definition and it refers to the number of elements within the array. A numeric constant, a variable whose value is a number, a numeric SAS expression, or an asterisk (*) may be used as the subscript. The subscript must be enclosed within braces {}, square brackets [], or parentheses (). In our temperature example the subscript will be 24 for each of the 24 temperature variables:

array temperature_array {24} temp1 – temp24;

When the asterisk is used, it is not necessary to know how many elements are contained within the array. SAS will count the number of elements for you. An example of using the asterisk is when one of the special variables defines the elements.

array allnums {*} _numeric_;

When it is necessary to know how many elements are in the array, the DIM function can be used to return the count of elements.

do i = 1 to dim(allnums);

allnums{i} = round(allnums{i},.1);

end;

In this example, when the array ALLNUMS is defined, SAS will count the number of numeric variables used as elements of the array. Then, in the DO group processing, the DIM function will return the count value as the ending range for the loop.

ARRAY REFERENCES

When an array is defined with the ARRAY statement SAS creates an array reference. The array reference is in the following form:

array-name{n}

The value of n will be the element’s position within the array. For example, in the temperature array defined above the temperature for 1:00 PM is in the variable TEMP13. The array element has been assigned the 13th position within the array. Therefore, the array reference will be:

temperature_array{13}

The variable name and the array reference are interchangeable. When an array has been defined in a data step either the variable name or the array reference may be used.

Variable Name Array Reference

temp1temperature_array{1}

temp2temperature_array{2}

temp3temperature_array{3}

temp4temperature_array{4}

temp5temperature_array{5}

An array reference may be used within the data step in almost any place other SAS variables may be used including as an argument to many SAS functions. If the data step does not have an ARRAY statement to define the array and create the array reference, errors will occur. When an array is referenced within a data step, it must be defined with an ARRAY statement in the same data step.

USING ARRAY INDEXES

The array index is the range of array elements. In our temperature example, we are looking at temperatures for each of the 24 hours of the day. The array is defined as:

array temperature_array {24} temp1 – temp24;

Another variation in SAS arrays from arrays within other languages is, subscripts are 1-based by default where arrays in other languages may be 0-based. When we set the array bounds with the subscript and only specify the number of elements within the array as our upper bound, the lower bound is the default value of 1. In our example, the index begins with the lower bound of 1 and ends with the upper bound of 24.

There may be scenarios when we want the index to begin at a lower bound other than 1. This is possible by modifying the subscript value when the array is defined. For this example we are using our same temperature variables. Only this time we only want the temperatures for the daytime, temperatures 6 through 18. In this example the array is defined as:

array temperature_array {6:18} temp6 – temp18;

The subscript will be written as the lower bound and upper bound of the range, separated by a colon.

This technique can simplify array usage by using natural values for the index. Examples of this might be to use a person’s age, or to use a year value to get to the correct element.

ONE DIMENSION ARRAYS

A simple array may be created when the variables grouped together conceptually appear as a single row. This is known as a one-dimensional array. Within the Program Data Vector the variable structure may be visualized as: temperature_array{1}{2}{3}{4}{5} (24)

Temperature Variables temp1Temp2temp3temp4temp5…temp24

The array statement to define this one-dimensional array will be:

array temperature_array {24} temp1 – temp24;

The array has 24 elements for the variables TEMP1 through TEMP24. When the array elements are used within the data step the array name and the element number will reference them. The reference to the ninth element in the temperature array is:

temperature_array{9}

MULTI-DIMENSION ARRAYS

A more complex array may be created in the form of a multi-dimensional array. Multi-dimensional arrays may be created in two or more dimensions. Conceptually, a two-dimensional array appears as a table with rows and columns. Within the Program Data Vector the variable structure may be visualized as:

2nd Dimension SALE_ARRAY{r,1}{r,2}{r,3}{r,4}…{r,12} Sales

Variables

{1,c}SALES1SALES2SALES3SALES4…SALES12

Expense Variables {2,c}EXP1EXP2EXP3EXP4…EXP12

1st Dimension

Commission

Variables

{3,c}COMM1COMM2COMM3COMM4…COMM12 The array statement to define this two-dimensional array will be:

array sale_array {3, 12} sales1-sales12 exp1-exp12 comm1-comm12;

The array contains three sets of twelve elements. When the array is defined the number of elements indicates the number of rows (first dimension), and the number of columns (second dimension). The first dimension of the array is the three sets of variable groups: sales, expense, and commission. The second dimension is the 12 values within the

group. When the array elements of a multi-dimensional array are used within the data step the array name and the element number for both dimensions will reference them. The reference to the sixth element for the expense group in the sales array is:

sale_array{2,6}

Three and more dimensions can be defined as well. It should be noted that if a PROC PRINT is run, only the actual variable names are displayed instead of the array elements, so it can sometimes be difficult to visualize the logical structure.

TEMPORARY ARRAYS

A temporary array is an array that only exists for the duration of the data step where it is defined. A temporary array is useful for storing constant values, which are used in calculations. In a temporary array there are no corresponding variables to identify the array elements. The elements are defined by the key word _TEMPORARY_.

When the key word _TEMPORARY_ is used, a list of temporary data elements is created is created in the Program Data Vector. These elements exist only in the Program Data Vector and are similar to pseudo-variables.

array{1}{2}{3}{4}{5}{6}

Variables

Values0.050.080.120.200.270.35

One method of setting the values for a temporary array’s elements is to indicate initial values in the ARRAY statement. Therefore, a temporary array of rate values might be defined as follows:

array rate {6} _temporary_ (0.05 0.08 0.12 0.20 0.27 0.35);

The values for the temporary data elements are automatically retained across iterations of the data step, but do not appear in the output data sets. With a few exceptions, temporary data elements behave in a manner similar to variables. Temporary data elements do not have names, therefore they may only be referenced using the array reference. The asterisk subscript cannot be used when defining a temporary array and explicit array bounds must be specified for temporary arrays.

We are now able to apply the constant values defined in the array. For example: when a customer is delinquent in payment of their account balance, a penalty is applied. The amount of the penalty depends upon the number of months that the account is delinquent. Without array processing this IF-THEN processing would be required to complete the calculation:

if month_delinquent eq 1 then balance = balance + (balance * 0.05);

else if month_delinquent eq 2 then balance = balance + (balance * 0.08);

else if month_delinquent eq 3 then balance = balance + (balance * 0.12);

else if month_delinquent eq 4 then balance = balance + (balance * 0.20);

else if month_delinquent eq 5 then balance = balance + (balance * 0.27);

else if month_delinquent eq 6 then balance = balance + (balance * 0.35);

By placing the penalty amounts into a temporary array, the code for calculating the new balance can be simplified. The penalty amounts have been stored in the temporary array RATE. The new account balance with the penalty can now be calculated as:

array rate {6} _temporary_ (0.05 0.08 0.12 0.20 0.27 0.35);

if month_delinquent ge 1 and month_delinquent le 6 then

balance = balance + (balance * rate{month_delinquent});

In addition to simplifying the code, the use of the temporary array also improves performance time.

Setting initial values is not required on the ARRAY statement. The values within a temporary array may be set in another manner within the data step.

array rateb {6} _temporary_;

do i = 1 to 6;

rateb{i} = i * 0.5;

end;

Earlier versions of SAS originally defined arrays in a more implicit manner as follows:

array array-name<(index-variable)> <$> array-elements <(initial-values)>; In an implicit array, an index variable may be indicated after the array name. This differs from the explicit array previously discussed where a constant value or an asterisk, as the subscript, denotes the array bounds. When an implicit array is defined, processing for every element in the array may be completed with a DO-OVER statement. The variable specified as the index variable is tied to the array and should only be used as the array index.

Example:

array item(j) $ 12 x1-x12;

do over item;

put item;

end;

When referencing the array, only the array name is specified. Thus, the implied notation, instead of the more explicit mode described earlier. If a program needed to reference by index-variable, that can also be done, but must be specified in a separate statement.

array item(j) $ 12 x1-x12;

do j=1 to 12;

put item;

end;

Because of the difficulty understanding the more cryptic implicit arrays, explicit arrays are recommended. Implicit array support was left in SAS only to insure older programs would continue to run.

SORTING ARRAYS

There are several new experimental call routines in SAS 9.1 that can be used to sort across a series of variables. SORTN can be used to sort numeric variables and SORTQ for character fields. An example of sorting several numeric variables is as follows:

data _null_;

array xarry{6} x1-x6;

set ds1;

call sortn(of x1-x6);

run;

When an observation from ds1 is processed the values brought into the Program Data Vector appear as follows:

xarry{1}{2}{3}{4}{5}{6}

Variables x1x2x3x4x5x6

Values0.270.120.200.080.350.05

The SORTN call routine will sort the values of the variables in ascending order and replace the Program Data Vector values with the new sorted values. Thus, after the call routine the Program Data Vector will appear as follows:

xarry{1}{2}{3}{4}{5}{6}

Variables x1x2x3x4x5x6

Values0.050.080.120.200.270.35

Because the values for the variables are now different the value selected by the array reference will be affected. For instance, to calculate rate we must add the value in the array reference to 0.75 as follows:

rate = 0.75 + xarry{i};

If the calculation is completed prior to the SORTN call routine and i is equal to 3, rate would be 0.95. On the other hand, if the same calculation were to be completed after the call routine, rate would be 0.87.

It makes sense to use arrays when there are repetitive values that are related and the programmer needs to iterate though most of them. The combination of arrays and do loops in the data step lend incredible power to programming. The fact that the variables in the array do not need to be related or even contiguous makes them even more convenient to use.

COMMON ERRORS AND MISUNDERSTANDINGS

Common errors and misunderstandings occur in array processing. This section will review several of these and how they are resolved.

INVALID INDEX RANGE

In the processing of array references, it is easy to use an index value from outside the array bounds. A typical instance when this occurs is while looping through the array references with DO group processing.

data dailytemp;

set tempdata;

array temperature_array {24} temp1-temp24;

array celsius_array {24} celsius_temp1-celsius_temp24;

do until (i gt 24);

i = 1;

celsius_array{i} = 5 / 9 * (temperature_array{i} – 31);

end;

i=0;

drop i;

run;

In the scenario a DO-UNTIL loop is used to process the 24 different temperatures. When a DO-UNTIL loop is processed the evaluation of the expression is not completed until the bottom of the loop. After processing for i equal to 24, the expression is still true. Therefore, processing remains within the loop and i will be incremented to 25. Both arrays used in the calculation were defined with only 24 elements. An index value of 25 is greater than the array’s upper bound. As a result, the data error message “Array subscript out of range” will be received.

There are two possible resolutions to this scenario. One possibility is to continue using the DO-UNTIL loop, but change the expression to check for I greater than 23:

do until (i gt 23);

i = 1;

celsius_array{i} = 5 / 9 * (temperature_array{i} – 31);

end;

Another possibility is to modify the loop to DO-WHILE processing. A DO-WHILE loop evaluates the expression first and if the expression is true the processing within the loop will continue. Therefore, the modified code for using a

DO-WHILE loop would be:

do while (i le 24);

i = 1;

celsius_array{i} = 5 / 9 * (temperature_array{i} – 31);

end;

FUNCTION NAME AS AN ARRAY NAME

The use of a function name as an array name on the ARRAY statement may cause unpredictable results. If a function name is used as an array name, SAS will no longer recognize the name as a function name. Therefore, rather than seeing parenthetical values as function arguments, SAS now sees those values as the index value for an array reference.

When a function name is used to define an array name SAS will provide a warning in the log. If the function is then used within the data step error messages may be received as result of SAS attempting to interpret the function arguments as an array reference.

8 data dailytemp;

9 set tempdata;

10 array mean {24} temp1-temp24;

WARNING: An array is being defined with the same name as a SAS-supplied or user-defined function. Parenthesized references involving this name will be treated as array references and not function references.

11 do i = 1 to 24;

12 meantemp = mean(of temp1-temp24);

ERROR: Too many array subscripts specified for array MEAN.

13 end;

14run;

15

Avoiding function names as array names is a simple resolution in this scenario.

ARRAY REFERENCED IN MULTIPLE DATA STEPS, BUT DEFINED IN ONLY ONE

Every data step where an array is referenced it must be defined within the step with an ARRAY statement. A sample program contains the following data steps:

data dailytemp;

set tempdata;

array temperature_array {24} temp1-temp24;

array celsius_array {24} celsius_temp1-celsius_temp24;

do i = 1 to 24;

celsius_array{i} = 5 / 9 * (temperature_array{i} – 31);

end;

run;

data celsius;

set dailytemp;

do i = 1 to 24;

if celsius_array{i} lt 0 then tempdesc = ‘below freezing’;

else if celsius_array{i} gt o then tempdesc = ‘above freezing’;

end;

run;

The first data step contains the definition of the array CELSIUS_ARRAY on the second ARRAY statement. References to the array do not cause any issues. The second data step has two references to the array but the array has not been defined within this data step.

The resolution to this issue requires the inclusion of the ARRAY statement to define the array within every data step where it is referenced. Therefore, the second data step would be modified as follows:

data celsius;

set dailytemp;

array celsius_array {24} celsius_temp1-celsius_temp24;

do i = 1 to 24;

if celsius_array{i} lt 0 then tempdesc = ‘below freezing’;

else if celsius_array{i} gt o then tempdesc = ‘above freezing’;

end;

run;

CONCLUSION

Arrays are not a mystery, but a wonderful tool for Data step programmers that need to reference repetitive values.

CONTACT INFORMATION

Your comments and questions are valued and encouraged. Contact the author at:

Steve First

Systems Seminar Consultants, Inc.

2997 Yarmouth Greenway Dr

Madison, WI 53711

Work Phone: (608) 279-9964 x302

Fax: (608) 278-0065

Email: sfirst@https://www.360docs.net/doc/2015879209.html,

Web: https://www.360docs.net/doc/2015879209.html,

Teresa Schudrowitz

Systems Seminar Consultants, Inc.

2997 Yarmouth Greenway Dr

Madison, WI 53711

Work Phone: (608) 279-9964 x309

Fax: (608) 278-0065

Email: tschudrowitz@https://www.360docs.net/doc/2015879209.html,

Web: https://www.360docs.net/doc/2015879209.html,

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ? indicates USA registration.

Other brand and product names are trademarks of their respective companies.

SAS统计分析教程方法总结

对定量结果进行差异性分析 1.单因素设计一元定量资料差异性分析 1.1.单因素设计一元定量资料t检验与符号秩和检验 T检验前提条件:定量资料满足独立性和正态分布,若不满足则进行单因素设计一元定量资料符号秩和检验。 1.2.配对设计一元定量资料t检验与符号秩和检验 配对设计:整个资料涉及一个试验因素的两个水平,并且在这两个水平作用下获得的相同指标是成对出现的,每一对中的两个数据来自于同一个个体或条件相近的两个个体。 1.3.成组设计一元定量资料t检验 成组设计定义: 设试验因素A有A1,A2个水平,将全部n(n最好是偶数)个受试对象随机地均分成2组,分别接受A1,A2,2种处理。再设每种处理下观测的定量指标数为k,当k=1时,属于一元分析的问题;当k≥2时,属于多元分析的问题。 在成组设计中,因2组受试对象之间未按重要的非处理因素进行两两配对,无法消除个体差异对观测结果的影响,因此,其试验效率低于配对设计。 T检验分析前提条件:

独立性、正态性和方差齐性。 1.4.成组设计一元定量资料Wil coxon秩和检验 不符合参数检验的前提条件,故选用非参数检验法,即秩和检验。1.5.单因素k(k>=3)水平设计定量资料一元方差分析 方差分析是用来研究一个控制变量的不同水平是否对观测变量产生了显著影响。这里,由于仅研究单个因素对观测变量的影响,因此称为单因素方差分析。 方差分析的假定条件为: (1)各处理条件下的样本是随机的。 (2)各处理条件下的样本是相互独立的,否则可能出现无法解析的输出结果。 (3)各处理条件下的样本分别来自正态分布总体,否则使用非参数分析。(4)各处理条件下的样本方差相同,即具有齐效性。 1.6.单因素k(k>=3)水平设计定量资料一元协方差分析 协方差分析(Analysis of Covariance)是将回归分析与方差分析结合起来使用的一种分析方法。在这种分析中,先将定量的影响因素(即难以控制的因素)看作自变量,或称为协变量(Covariate),建立因变量随自变量变化的回归方程,这样就可以利用回归方程把因变量的变化中受不易控制的定量因素的影响扣除掉,从而,能够较合理地比较定性的影响因素处在不同水平下,经过回归分析手段修正以后的因变量的样本均数之间的差别是否有统计学意义,这就是协方差分析解决问题的基本计算原理。

SASreport过程介绍

PROC REPORT基础一、PROC REPORT格式: PROC REPORT data= SAS-data-set options ; COLUMNS variable_1 …. variable_n; DEFINE variable_1; DEFINE variable_2; . . . DEFINE variable_n; COMPUTE blocks BREAK … ; RBREAK … ; RUN; COLUMNS:指定输出到报表的列 DEFINE:上述列的格式等 COMPUTE:计算模块 BREAK / RBREAK:生成合计,或报表其它类型的格式。 PROC REPORT的选项Options有很多,下面介绍几个常用的:DATA= 指定做报表的数据集 PROMPT= PROMPT模式 NOWINDOWS= 不输出到结果 REPORT = 指定一个存储的报表来生成新报表 OUTREPT= 指定新路径来存放报表 OUT= 建立新数据集 HEADLINE 在报表变量标题和内容间生成一个水平分隔线HEADSKIP 在报表变量标题和内容间生成一行空格 2 先生成一个基本的报表 先生成数据: data mnthly_sales; length zip $ 5 cty $ 8 var $ 10; input zip $ cty $ var $ sales; label zip="Zip Code" cty="County" var="Variety" sales="Monthly Sales"; datalines; 52423 Scott Merlot 186. 52423 Scott Chardonnay 156.61 52423 Scott Zinfandel 35.5 52423 Scott Merlot 55.3 52388 Scott Merlot 122.89

C++ #pragma code_seg用法

#pragma code_seg 格式如: #pragma code_seg( [ [ { push | pop}, ] [ identifier, ] ] [ "segment-name" [, "segment-class" ] ) 该指令用来指定函数在.obj文件中存放的节,观察OBJ文件可以使用VC自带的dumpbin命令行程序,函数在.obj文件中默认的存放节为.text节,如果code_seg 没有带参数的话,则函数存放在.text节中。 push (可选参数)将一个记录放到内部编译器的堆栈中,可选参数可以为一个标识符或者节名 pop(可选参数)将一个记录从堆栈顶端弹出,该记录可以为一个标识符或者节名identifier(可选参数)当使用push指令时,为压入堆栈的记录指派的一个标识符,当该标识符被删除的时候和其相关的堆栈中的记录将被弹出堆栈 "segment-name" (可选参数)表示函数存放的节名 例如: //默认情况下,函数被存放在.text节中 void func1() {// stored in .text } //将函数存放在.my_data1节中 #pragma code_seg(".my_data1") void func2() {// stored in my_data1 } //r1为标识符,将函数放入.my_data2节中 #pragma code_seg(push, r1, ".my_data2") void func3() {// stored in my_data2 } int main() { } 例如 #pragma code_seg(“PAGE”) 作用是将此部分代码放入分页内存中运行。 #pragma code_seg() 将代码段设置为默认的代码段 #pragma code_seg("INIT") 加载到INIT内存区域中,成功加载后,可以退出内存

常见成语解析及成语故事

常见成语解析及成语故事 换骨夺胎 【注音】huàn gǔ duó tāi 【成语故事】换骨夺胎原是道家传说吃了金丹换去凡骨凡胎后成仙。古代文人借用以前古文的意思用自己的语言去表达,黄庭坚认为这是换骨法,深入研究古文的原意进一步加以刻划形容,这叫夺胎法。也有人说不蹈古人一言一句,用夺胎换骨法可以点铁成金。 【出处】然不易其意而造其语,谓之换骨法;窥入其意而形容之,谓之夺胎法。宋·释惠洪《冷斋夜话·换骨夺胎法》 【解释】比喻诗文活用古人之意,推陈出新。 【用法】作谓语、定语;用于诗文等 【相近词】脱胎换骨、夺胎换骨 【成语举例】他临摹古画有换骨夺胎之妙,当然能够乱真。 提名道姓 【拼音】tí míng dào xìng 【成语故事】王夫人、薛宝钗、林黛玉等在贾母房内聊天,有人汇报史湘云来了,众人迎接,大观园内又多了一位金钗。贾宝玉跑来看史湘云,一见十分快乐,亲热的叫她的名字。王夫人要他不要提名道姓,她们在一起又玩个昏天黑地。 【出处】这里老太太才说这一个,他又来提名道姓的了。清·曹雪芹《红楼梦》第31回

【释义】提、道:说。直呼别人姓名,对人不够尊敬。 【用法】作谓语、宾语;指直呼别人姓名 【相近词】指名道姓、习题名道姓 【反义词】含沙射影 【成语例句】 ◎你得喝醉哟,不然哪里敢!既醉,则挑鼻子弄眼,没必要提名道姓,而以散文诗冷嘲,继以热骂:头发烫得像鸡窝,能孵小鸡么?曲线美,直线美又几个钱一斤?老子的钱是容易挣得?哼!诸如此类,无须管层次清楚与否,但求气势畅利。 ◎设若要摆,也不应该提名道姓。 随遇而安 【注音】:suí yùér ān 【释义】:随:顺从;遇:遭遇。指能顺应环境,在任何境遇中都能满足。 【出处】:清·刘献廷《广阳杂记》一:“随寓而安,斯真隐矣。”清·文康《儿女英雄传》第24回:“吾生有涯,浩劫无涯,倒莫如随遇而安。” 【用法】:偏正式;作谓语、宾语、定语、状语;含褒义;指能顺应环境 【示例】:不过能够~——即有船坐船云云——则比起幻想太多的人们来,可以稍为安稳,能够敷衍下去而已。(鲁迅《两地书》六)【近义词】:与世无争、随俗浮沉

五个字的成语故事分享

五个字的成语故事分享 导读:本文五个字的成语故事分享,仅供参考,如果觉得很不错,欢迎点评和分享。 售胝足之药 【成语故事】从前有人在市场上卖治脚茧药,在门上挂“供御”的招牌,人们讥笑他不诚实。皇帝知道后,派人传唤他,并把他投入监狱。他遇大赦而回家,就又重操旧业,在招牌上面增加“曾经宣唤”4字,以此来招徕顾客。 【出处】昔人有以胝足之药售于市者,辄揭扁于门曰:‘供御。’《厅史》 【解释】胝:手掌或脚掌上的老茧。指卖狗皮膏药骗人。 【用法】作谓语、宾语;指卖狗皮膏药 覆巢无完卵 【成语故事】东汉末年,北海相孔融反对曹操率50万大军征讨刘备与孙权,御史大夫向来与孔融不合,在曹操面前添油加醋,恶意挑拨。曹操大怒,命人逮捕孔融全家,孔融的孩子无动于衷,也不逃跑,说:“大人,岂见覆巢之下复有完卵乎?” 【出处】大人,岂见覆巢之下复有完卵乎?南朝·宋·刘义庆《世说新语·言语》 【解释】复:翻倒。翻倒的鸟窝里不会有完好的卵。比喻灭门大祸,无一幸免。又比喻整体毁灭,个体也不能幸存。

【用法】作定语、分句;比喻整体毁灭,个体不能幸存 【近义词】覆巢破卵 【成语示列】你是知道覆巢无完卵的结局的。 民以食为天 【成语故事】楚汉相争时期,刘邦与项羽在颖阳一带打仗,由于没有后援,刘邦准备放弃敖山粮仓,找谋士郦食其商量。郦食其认为称王要依赖百姓,百姓又依赖粮食。要想赢得战争,必须占据敖仓,才能稳住军心。刘邦赞同并奋勇作战取得了胜利。 【典故】天:比喻赖以生存的最重要的东西。人民以粮食为自己生活所系。指民食的重要。 【释义】天:比喻赖以生存的最重要的东西。人民以粮食为自己生活所系。指民食的重要。 【用法】作宾语、定语;指粮食的重要性 【近义词】国以粮为本 【成语举例】 ◎民以食为天,吃饱肚子是大别山人祖祖辈辈的梦想:"谁让我们吃饱饭,就选谁当县长。" ◎解放几十年来农业还没有从根本上过关的历史教训和现实状况都告诉我们:国以民为本、民以食为天。 ◎民以食为天,国以农为本,这是我国的基本国情,要实现跨世纪的宏伟目标,解决好农业问题至关重要.

C++ #pragma预处理命令

#pragma预处理命令 #pragma可以说是C++中最复杂的预处理指令了,下面是最常用的几个#pragma 指令: #pragma comment(lib,"XXX.lib") 表示链接XXX.lib这个库,和在工程设置里写上XXX.lib的效果一样。 #pragma comment(linker,"/ENTRY:main_function") 表示指定链接器选项/ENTRY:main_function #pragma once 表示这个文件只被包含一次 #pragma warning(disable:4705) 表示屏蔽警告4705 C和C++程序的每次执行都支持其所在的主机或操作系统所具有的一些独特的特点。例如,有些程序需要精确控制数据存放的内存区域或控制某个函数接收的参数。#pragma为编译器提供了一种在不同机器和操作系统上编译以保持C和C++完全兼容的方法。#pragma是由机器和相关的操作系统定义的,通常对每个编译器来说是不同的。 如果编译器遇到不认识的pragma指令,将给出警告信息,然后继续编译。Microsoft C and C++ 的编译器可识别以下指令:alloc_text,auto_inline,bss_seg,check_stack,code_seg,comment,component,conform,const_seg,data_seg,deprecated,fenv_access,float_control,fp_contract,function,hdrstop,include_alias,init_seg,inline_depth,inline_recursion,intrinsic,make_public,managed,message,omp,once,optimize,pack,pointers_to_members,pop_macro,push_macro,region, endregion,runtime_checks,section,setlocale,strict_gs_check,unmanaged,vtordisp,warning。其中conform,init_seg, pointers_to_members,vtordisp仅被C++编译器支持。 以下是常用的pragma指令的详细解释。 1.#pragma once。保证所在文件只会被包含一次,它是基于磁盘文件的,而#ifndef 则是基于宏的。

成语故事(文言文版)阅读

第二十一课时,成语故事(文言文版)阅读 教学目标: 1,了解成语,学习感悟其中的道理 2,积累文言文实词及虚词的用法。 3,掌握文言文常见语法现象。 课堂笔记: 成语故事(文言文版)阅读 引婴投江 有过于江上者,见人方()引婴儿而欲投之江中。婴儿啼。人问其故,曰:“此其父善游!” 其父虽善游,其子岂()遽善游哉?以此任物,亦必悖矣。 刻舟求剑 楚人有涉( )江者,其剑自舟中坠于水。遽( )契其舟,曰:“是( )吾剑之所从坠。”舟止,从其所契者入水求之。 舟已行矣,而剑不行。求剑若此,不亦惑乎!

叶公好龙 叶公好龙,室中雕文( )尽以为龙。于是天龙闻而下之,窥头于牖( ),拖尾于堂。叶公见之,弃而还走( ),失其魂魄,五神无主。 是( )叶公非好龙也,夫似龙而非龙也。 郑人买履 郑人有且置履( )者,先自度( )而置之其坐,至之市而忘操( )之,已得履,乃曰:“吾忘持度。”反( )归取之。及反,市罢( ),遂不得履。 人曰:“何不试之以足?”曰:“宁信度,无自信也。” 自相矛盾 楚人有卖盾与矛者,誉( )之曰:“吾盾之坚,物莫能陷( )也。”又誉其矛曰:“吾矛之利,于物无不陷也。”或曰:“以子( )之矛,陷子之盾,何如?”其人弗能应也。 夫不可陷之盾与无不陷之矛,不可同世而立。 守株待兔 宋人有耕者。田中有株。兔走()触株,折颈而死。因释其耒()而守株,冀()复得兔。兔不可得得,而身为宋国笑。 拔苗助长 宋人有悯()其苗之不长而揠()之者,芒芒然()归,谓其人曰:“今日病矣!予助苗长矣。”其子趋()而往视之,苗则槁矣。 天下之不助苗长者()寡矣。助之长者,揠苗者也。非徒()无益,而又害之。 滥()竽充数 齐宣王使人吹竽,必()三百人。南郭处士请为王吹竽。宣王悦之,廪()食以数百人。宣王死,湣王立。好一一听之。处士逃。 涸辙之鲋

SAS proc mixed 过程步介绍

Introduction to PROC MIXED Table of Contents 1.Short description of methods of estimation used in PROC MIXED 2.Description of the syntax of PROC MIXED 3.References 4. Examples and comparisons of results from MIXED and GLM - balanced data: fixed effect model and mixed effect model, - unbalanced data, mixed effect model 1. Short description of methods of estimation used in PROC MIXED. The SAS procedures GLM and MIXED can be used to fit linear models. Proc GLM was designed to fit fixed effect models and later amended to fit some random effect models by including RANDOM statement with TEST option. The REPEATED statement in PROC GLM allows to estimate and test repeated measures models with an arbitrary correlation structure for repeated observations. The PROC MIXED was specifically designed to fit mixed effect models. It can model random and mixed effect data, repeated measures, spacial data, data with heterogeneous variances and autocorrelated observations.The MIXED procedure is more general than GLM in the sense that it gives a user more flexibility in specifying the correlation structures, particularly useful in repeated measures and random effect models. It has to be emphasized, however, that the PROC MIXED is not an extended, more general version of GLM. They are based on different statistical principles; GLM and MIXED use different estimation methods. GLM uses the ordinary least squares (OLS) estimation, that is, parameter estimates are such values of the parameters of the model that minimize the squared difference between observed and predicted values of the dependent variable. That approach leads to the familiar analysis of variance table in which the variability in the dependent variable (the total sum of squares) is divided into variabilities due to different sources (sum of squares for effects in the model). PROC MIXED does not produce an analysis of variance table, because it uses estimation methods based on different principles. PROC MIXED has three options for the method of estimation. They are: ML (Maximum Likelihood), REML (Restricted or Residual maximum likelihood, which is the default method) and MIVQUE0 (Minimum Variance Quadratic Unbiased Estimation). ML and REML are based on a maximum likelihood estimation approach. They require the assumption that the distribution of the dependent variable (error term and the random effects) is normal. ML is just the regular maximum likelihood method,that is, the parameter estimates that it produces are such values of the model parameters that maximize the likelihood function. REML method is a variant of maximum likelihood estimation; REML estimators are obtained not from maximizing the whole likelihood function, but only that part that is invariant to the fixed effects part of the linear model. In other words, if y = X b + Zu + e, where X b is the

#pragma data code ICCAVR的使用

#pragma data:code 在Keil中为了节省数据存储器的空间,通过“code”关键字来定义一个数组或字符串将被存储在程序存储器中: uchar code buffer[]={0,1,2,3,4,5}; uchar code string[]="Armoric" ; 而这类代码移值到ICCAVR上时是不能编译通过的。我们可以通过"const" 限定词来实现对存储器的分配: #pragma data:code const unsigned char buffer[]={0,1,2,3,4,5}; const unsigned char string[]="Armoric"; #pragma data:data 注意: 《1》使用ICCAVR6.31时,#pragma data :code ;#pragma data:data ; 这些语法时在"data:cod"、"data:data"字符串中间不能加空格,否则编译不能通过。 《2》const 在ICCAVR是一个扩展关键词,它与ANSIC标准有冲突,移值到其它的编译器使用时也需要修改相关的地方。 在ICCAVR中对数组和字符串的五种不同空间分配: const unsigned char buffer[]={0,1,2,3,4,5}; //buffer数组被分配在程序存储区中 const unsigned char string[]="Armoric" ; //stringp字符串被分配在程序存储区中 const unsigned char *pt //指针变量pt被分配在数据存储区中,指向程序存储区中的字符类型数据 unsigned char *const pt //指针变量pt被分配在程序存储区中,指向数据存储区中的字符类型数据 const unsigned char *const pt //指针变量pt被分配在程序存储区,指向程序存储区中的字符类型数据 unsigned char *pt //指针变量pt被分配在数据存储区中,指向数据存储区中的数据 请问#pragma data:code和#pragma data:data是什么意思? 前者表示:随后的数据将存贮在程序区,即FLASH区,此区只能存贮常量,比如表格之类。

有关后生可畏成语故事及用法

有关后生可畏成语故事及用法 【解释】后生:青年人,后辈;畏:敬畏,佩服。指青年人势必超过前辈,令人敬畏。 后生可畏成语故事及用法 【读音】hòu shēng kě wèi 【解释】后生:青年人,后辈;畏:敬畏,佩服。指青年人势必超过前辈,令人敬畏。 【出处】《论语·子罕》后生可畏,焉知来者之不如也! 【用法】主谓式;作谓语、宾语、分句;含褒义,称赞年轻人。 【近义词】少年老成、长江后浪推前浪 【反义词】少不更事、乳臭未干 【语法】:主谓式;作谓语、宾语、分句;含褒义,称赞年轻人 故事: 元朝的大臣彻里帖木耳,处理公务精明干练,善于决断。有一年他在浙江任职,正好逢上省城举行科举考试。他目睹了这场考试,从官府到考生都花费了很多钱财,并且免不了有营私舞弊的情况。他暗暗下了决心,待到自己掌握了大权,一定要促使朝廷废除这种制度。后来,他升任相当于副宰相的中书平章政事,便奏告元顺帝,请求废除科举制度。中国科举制度隋唐以来已实行了七百多年,要废除它是一件非常重大的事,在朝中引起了巨大的反响。大师伯颜表示支持,但反对的很多。有位御史坚决反对废除科举制度,他请求顺帝治彻里帖木耳的罪。不料顺帝虽然很昏庸,但对废除科举制度倒是赞成的。所以不但不支持那位御史,反而把他贬到外地去当官。

不久,他命人起草了废除科举制度的诏书,准备颁发下去。书还 未下达,地位略低于平章的参政许有王,又出来反对废除科举制度。 他对伯颜说:“如果废除科举考试制度,世上有才能的人都会怨恨的。”伯颜针锋相对地说:“如果继续实行科举考试制度,世上贪赃 枉法的人还要多。”许有王反驳说:“没有实行科举考试制度的时候,贪赃枉法的人也不是很多吗?”伯颜讽刺他说:“我看中举的人中有用 之材太少,只有你参政一个人能够任用!”许有王不服气,举出很多当 时中举的高官来反驳伯额。伯颜当然不会改变自己的观点,于是两人 争论得非常激烈。第二天,满朝文武被召到祟天门听读皇帝下达的废 除科举制席的诏书,许有王还特地被侮辱性地通知在班首听读。看来,皇帝特意要让这个反对者将诏书听得明白些。许有王心里非常不愿意,但又惧怕得罪皇帝遭到祸害,只好勉强跪在百官前列听读诏书。听读 完诏书后,百官纷纷回府,许有王满脸不高兴地低头走路。 有个名叫普化的御史特地走到他边上,凑着他的耳朵冷嘲热讽他说:“参政,你这下成为过河拆桥的人啦。这话的意思是,你许参政 是靠科举当官的,现在宣读皇上关于废除科举制度诏书,你跪在最前面,似乎是废除科举制度的领头人,就像一个人过了桥后就把桥拆掉 一样。许有王听了又羞又恨,加快步伐离开。之后他借口有病,再也 不上朝了。

SAS中的描述性统计过程

SAS中的描述性统计过程 (2012-08-01 18:07:01) 转载▼ 分类:数据分析挖掘 标签: 杂谈 SAS中的描述性统计过程 描述性统计指标的计算可以用四个不同的过程来实现,它们分别是means过程、summary 过程、univariate过程以及tabulate过程。它们在功能范围和具体的操作方法上存在一定的差别,下面我们大概了解一下它们的异同点。 相同点:他们均可计算出均数、标准差、方差、标准误、总和、加权值的总和、最大值、最小值、全距、校正的和未校正的离差平方和、变异系数、样本分布位置的t检验统计量、遗漏数据和有效数据个数等,均可应用by语句将样本分割为若干个更小的样本,以便分别进行分析。 不同点: (1)means过程、summary过程、univariate过程可以计算样本的偏度(skewness)和峰度(kurtosis),而tabulate过程不计算这些统计量; (2)univariate过程可以计算出样本的众数(mode),其它三个过程不计算众数; (3)summary过程执行后不会自动给出分析的结果,须引用output语句和print过程来显示分析结果,而其它三个过程则会自动显示分析的结果; (4)univariate过程具有统计制图的功能,其它三个过程则没有; (5)tabulate过程不产生输出资料文件(存储各种输出数据的文件),其它三个均产生输出资料文件。 统计制图的过程均可以实现对样本分布特征的图形表示,一般情况下可以使用的有chart过程、plot过程、gchart过程和gplot过程。大家有没有发现前两个和后两个只有一个字母‘g’(代表graph)的差别,其实它们之间(只差一个字母g的过程之间)的统计描述功能是相同的,区别仅在于绘制出的图形的复杂和美观程度。 chart过程和plot过程绘制的图形类似于我们用文本字符堆积起来的图形,只能概括地反映出资料分布的大体形状,实际上这两个过程绘制的图形并不能称之为图形,因为他根本就没有涉及一般意义上图形的任何一种元素(如颜色、分辨率等)。而gchart过程和gplot过程给出的是真正意义上的图形,可以用很多的语句和选项来控制图形的各方面的性质和特征。 chart和gchart与plot和gplot的区别则体现在不同的作图功能,前两个过程可以绘制出的图形主要有条形图(包括横条和竖条)、圆图、环形图和星形图等,后两个过程通常用一个记录中的两个变量值表示点的坐标来绘制图形,如散点图和线图等。 描述性统计过程的一般格式 1. means过程的一般格式

pragma的用法

#pragma的用法 在所有的预处理指令中,#Pragma 指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作。#pragma指令对每个编译器给出了一个方法,在保持与C和C++语言完全兼容的情况下,给出主机或操作系统专有的特征。依据定义, 编译指示是机器或操作系统专有的,且对于每个编译器都是不同的。 其格式一般为: #pragma para。其中para为参数,下面来看一些常用的参数。 1)message 参数 message参数是我最喜欢的一个参数,它能够在编译信息输出窗口中输出相应的信息,这对于源代码信息的控制是非常重要的。其使用方法为: #pragma message("消息文本") 当编译器遇到这条指令时就在编译输出窗口中将消息文本打印出来。 当我们在程序中定义了许多宏来控制源代码版本的时候,我们自己有可能都会忘记有 没有正确的设置这些宏, 此时我们可以用这条指令在编译的时候就进行检查。假设我们希望判断自己有没有在源代码的什么地方定义了_X86这个宏, 可以用下面的方法: #ifdef _X86 #pragma message("_X86 macro activated!") #endif 我们定义了_X86这个宏以后,应用程序在编译时就会在编译输出窗口里显示"_86 macro activated!"。 我们就不会因为不记得自己定义的一些特定的宏而抓耳挠腮了。 (2)另一个使用得比较多的pragma参数是code_seg 格式如: #pragma code_seg( ["section-name" [, "section-class"] ] ) 它能够设置程序中函数代码存放的代码段,当我们开发驱动程序的时候就会使用到 它。 (3)#pragma once (比较常用) 只要在头文件的最开始加入这条指令就能够保证头文件被编译一次,这条指令实际上 在VC6中就已经有了, 但是考虑到兼容性并没有太多的使用它。 (4)#pragma hdrstop 表示预编译头文件到此为止,后面的头文件不进行预编译。BCB可以预编译头文件以 加快链接的速度, 但如果所有头文件都进行预编译又可能占太多磁盘空间,所以使用这个选项排除一些头文

成语故事大全

成语故事大全.txt当你以为自己一无所有时,你至少还有时间,时间能抚平一切创伤,所以请不要流泪。能满足的期待,才值得期待;能实现的期望,才有价值。保持青春的秘诀,是有一颗不安分的心。不是生活决定何种品位,而是品位决定何种生活。成语故事大全 南柯一梦 隋末唐初的时候,有个叫淳于尊的人,家住在广陵。他家的院中有一棵根深叶茂的大槐树,盛夏之夜,月明星稀,树影婆婆,晚风习习,是一个乘凉的好地方。 淳于尊过生日的那天,亲友都来祝寿,他一时高兴.多贪了几杯。夜晚,亲友散尽,他一个人带着几分酒意坐在槐树下歇凉,醉眼膝俄,不觉沉沉睡去。 梦中,他到了大槐安国,正赶上京城会试,他报名入场,三场结束,诗文写得十分顺手,发榜时,他高中了第一名。紧接着殿试,皇帝着浮于弊生得一表人才,举止惆院,亲笔点为头名状元,并把公主许配给他为妻,状元公成了驸马郎,一时成了京城的美谈。 婚后,夫妻感情十分美满。淳于尊被皇帝派往南河郡任太守,一呆就是20年。淳于尊在太守任内经常巡行各县,使属下各县的县令不敢胡作非为,很受当地百姓的称赞。皇帝几次想把淳于尊调回京城升迁,当地百姓听说淳于太守离任,纷纷拦住马头,进行挽留。淳于尊为百姓的爱戴所感动,只好留下来,并上表向皇帝说明情况。皇帝欣赏淳于尊的政绩,赏给他不少金银珠宝,以示奖励。有一年,敌兵入侵,大槐安国的将军率军迎敌,几次都被敌兵打得溃不成军。败报传到京城,皇帝震动,急忙召集文武群臣商议对策。大臣们听说前线军事屡屡失利,敌兵逼近京城,凶猛异常,一个个吓得面如土色,你看我,我看你,都束手无策。 皇帝看了大臣的样子,非常生气地说:“你们平田养尊处优,享尽荣华,朝中一旦有事,你们都成了没嘴的葫芦,胆小怯阵,一句话都不说,要你们何用?” 宰相立刻向皇帝推荐淳于尊。皇帝立即下令,让淳于尊统率全国精锐与敌军决战。 淳于尊接到圣旨,不敢耽搁,立即统兵出征。可怜他对兵法一无所知,与敌兵刚一接触,立刻一败涂地,手下兵马被杀得丢盔解甲,东逃西散,淳于尊差点被俘。皇帝震怒,把淳于尊撤掉职务,遣送回家。淳于尊气得大叫一声,从梦中惊醒,但见月上枝头,繁星闪烁。此时他才知道,所谓南河郡,不过是槐树最南边的一枝树干而已。 后生可畏 【读音】 hòu shēng kě wai 【解释】后生:青年人,后辈;畏:敬畏,佩服。指青年人势必超过前辈,令人敬畏。【出处】《论语·子罕》后生可畏,焉知来者之不如也! 【用法】主谓式;作谓语、宾语、分句;含褒义,称赞年轻人。 【近义词】少年老成、长江后浪推前浪 【反义词】少不更事、乳臭未干 【语法】:主谓式;作谓语、宾语、分句;含褒义,称赞年轻人 故事: 元朝的大臣彻里帖木耳,处理公务精明干练,善于决断。有一年他在浙江任职,正好逢上省城举行科举考试。他目睹了这场考试,从官府到考生都花费了许多钱财,并且免不了有

SAS入门教程

第一章SAS系统概况 SAS(Statistic Analysis System)系统是世界领先的信息系统,它由最初的用于统计分析经不断发展和完善而成为大型集成应用软件系统;具有完备的数据存取、管理、分析和显示功能。在数据处理和统计分析领域,SAS系统被誉为国际上的标准软件系统。 SAS系统是一个模块化的集成软件系统。SAS系统提供的二十多个模块(产品)可完成各方面的实际问题,功能非常齐全,用户根据需要可灵活的选择使用。 ●Base SAS Base SAS软件是SAS系统的核心。主要功能是数据管理和数据加工处理,并有报表生成和描述统计的功能。Base SAS软件可以单独使用,也可以同其他软件产品一起组成一个用户化的SAS系统。 ●SAS/AF 这是一个应用开发工具。利用SAS/AF的屏幕设计能力及SCL语言的处理能力可快速开发各种功能强大的应用系统。SAS/AF采用先进的OOP(面向对象编程)的技术,是用户可方便快速的实现各类具有图形用户界面(GUI)的应用系统。 ●SAS/EIS 该软件是SAS系统种采用OOP(面向对象编程)技术的又一个开发工具。该产品也称为行政信息系统或每个人的信息系统。利用该软件可以创建多维数据库(MDDB),并能生成多维报表和图形。 ●SAS/INTRNET ●SAS/ACCESS 该软件是对目前许多流行数据库的接口组成的接口集,它提供的与外部数据库的接口是透明和动态的。 第二章Base SAS软件 第一节SAS编程基础 SAS语言的编程规则与其它过程语言基本相同。 SAS语句 一个SAS语句是有SAS关键词、SAS名字、特殊字符和运算符组成的字符串,并以分号(;)结尾。 注释语句的形式为:/*注释内容*/ 或*注释内容。 二、SAS程序 一序列SAS语句组成一个SAS程序。SAS程序中的语句可分为两类步骤:DA TA步和

stm32中使用#pragma pack(非常有用的字节对齐用法说明)

#pragma pack(4) //按4字节对齐,但实际上由于结构体中单个成员的最大占用字节数为2字节,因此实际还是按2字节对齐 typedef struct { char buf[3];//buf[1]按1字节对齐,buf[2]按1字节对齐,由于buf[3]的下一成员word a是按两字节对齐,因此buf[3]按1字节对齐后,后面只需补一空字节 word a; //#pragma pack(4),取小值为2,按2字节对齐。 }kk; #pragma pack() //取消自定义字节对齐方式 对齐的原则是min(sizeof(word ),4)=2,因此是2字节对齐,而不是我们认为的4字节对齐。 这里有三点很重要: 1.每个成员分别按自己的方式对齐,并能最小化长度 2.复杂类型(如结构)的默认对齐方式是它最长的成员的对齐方式,这样在成员是复杂类型时,可以最小化长度 3.对齐后的结构体整体长度必须是成员中最大的对齐参数的整数倍,这样在处理数组时可以保证每一项都边界对齐 补充一下,对于数组,比如: char a[3];这种,它的对齐方式和分别写3个char是一样的.也就是说它还是按1个字节对齐. 如果写: typedef char Array3[3]; Array3这种类型的对齐方式还是按1个字节对齐,而不是按它的长度. 不论类型是什么,对齐的边界一定是1,2,4,8,16,32,64....中的一个. 声明: 整理自网络达人们的帖子,部分参照MSDN。 作用: 指定结构体、联合以及类成员的packing alignment; 语法: #pragma pack( [show] | [push | pop] [, identifier], n ) 说明: 1,pack提供数据声明级别的控制,对定义不起作用; 2,调用pack时不指定参数,n将被设成默认值; 3,一旦改变数据类型的alignment,直接效果就是占用memory的减少,但是performance会下降; 语法具体分析: 1,show:可选参数;显示当前packing aligment的字节数,以warning message的形式被显示; 2,push:可选参数;将当前指定的packing alignment数值进行压栈操作,这里的栈是the internal compiler stack,同时设置当前的packing alignment为n;如果n没有指定,则将当前的packing alignment数值压栈; 3,pop:可选参数;从internal compiler stack中删除最顶端的record;如果没有指定n,则当前栈顶record即为新的packing alignment 数值;如果指定了n,则n将成为新的packing aligment数值;如果指定了identifier,则internal compiler stack中的record都将被pop 直到identifier被找到,然后pop出identitier,同时设置packing alignment数值为当前栈顶的record;如果指定的identifier并不存在于internal compiler stack,则pop操作被忽略; 4,identifier:可选参数;当同push一起使用时,赋予当前被压入栈中的record一个名称;当同pop一起使用时,从internal compiler stack 中pop出所有的record直到identifier被pop出,如果identifier没有被找到,则忽略pop操作; 5,n:可选参数;指定packing的数值,以字节为单位;缺省数值是8,合法的数值分别是1、2、4、8、16。 重要规则: 1,复杂类型中各个成员按照它们被声明的顺序在内存中顺序存储,第一个成员的地址和整个类型的地址相同; 2,每个成员分别对齐,即每个成员按自己的方式对齐,并最小化长度;规则就是每个成员按其类型的对齐参数(通常是这个类型的大小)和指定对齐参数中较小的一个对齐; 3,结构体、联合体或者类的数据成员,第一个放在偏移为0的地方;以后每个数据成员的对齐,按照#pragma pack指定的数值和这个数据成员自身长度两个中比较小的那个进行;也就是说,当#pragma pack指定的值等于或者超过所有数据成员长度的时候,这个指定值的大小将不产生任何效果; 4,复杂类型(如结构体)整体的对齐是按照结构体中长度最大的数据成员和#pragma pack指定值之间较小的那个值进行;这样当数据成员为复杂类型(如结构体)时,可以最小化长度; 5,复杂类型(如结构体)整体长度的计算必须取所用过的所有对齐参数的整数倍,不够补空字节;也就是取所用过的所有对齐参数中最大的那个值的整数倍,因为对齐参数都是2的n次方;这样在处理数组时可以保证每一项都边界对齐; 对齐的算法:由于各个平台和编译器的不同,现以本人使用的gcc version 3.2.2编译器(32位x86平台)为例子,来讨论编译器对struct 数据结构中的各成员如何进行对齐的。 在相同的对齐方式下,结构体内部数据定义的顺序不同,结构体整体占据内存空间也不同,如下: 设结构体如下定义: struct A { int a; //a的自身对齐值为4,偏移地址为0x00~0x03,a的起始地址0x00满足0x00%4=0;

300字的成语故事

300字的成语故事 少数民族地区发生叛乱,他认为是贪官与无赖所为,起义军的力量是星星之火可以燎原,下令惩治贪官悍将,迅速平息了叛乱。 【典故】若火之燎于原,不可向迩。 《尚书·盘庚上》【解释】一点点小火星可以烧掉大片原野。 比喻开始时微小,但有远大发展前途的新事物。 【用法】作宾语、定语、分句;用于新生事物【近义词】星火燎原【示例】你不轻视了。 星星之火,可以燎原,不晓得怎么结局呢!张鸿《续孽海花》第57回【成语造句】◎直到1930年初,毛泽东的《星星之火,可以燎原》的问世,才在实际上解决了这个问题。 ◎是什么力量使他们坚信"星星之火,可以燎原",革命必然胜利呢?就是因为共产党人心中铭刻着共产主义的丰碑。 300字的成语故事(二):生公说法,顽石点头【注音】shēng gōng shuō fǎ , wán shí diǎn tóu【成语故事】晋末高僧竺道生15岁就登坛讲法,20岁上庐山讲授佛法,成为江南的佛学大师,他潜心研究刚传入中国的《涅槃经》,参悟到其中的奥妙,得出“人人皆可成佛的理论推断,因此被逐出庐山,他流浪到苏州虎丘山讲法,顽石都为之点头。 【出处】传说晋朝和尚道生法师对着石头讲经,石头都点头了。 比喻精通者亲自来讲解,必能透彻说理而使人感化。 【解释】shēnggōngshuōfǎ,wánshídiǎntóu【用法】作宾语、定语、

分句;用于书面语【相近词】生公说法 武帝在东堂巡游时接见了郤诜,问他自己感觉如何。 郤诜回答说:“臣举贤良对策,为天下第一,犹桂林之一枝,昆山之片玉。 【典故】累迁雍州刺史。 武帝于东堂会送,问诜曰:‘卿自以为何如?’诜对曰:‘臣举贤良对策,为天下第一,犹桂林之一枝,昆山之片玉。 ’《晋书·郤诜传》【解释】昆山:昆冈,古代产玉的地方。 桂花林中的一枝花,昆山中的一块玉。 比喻科举考试中的出类拔萃的佼佼者。 【用法】作宾语、分句;可分开使用【相近词】桂林一枝、昆山片玉300字的成语故事(四):刻画无盐,唐突西施【拼音】kè huà wú yán , táng tū xī shī【成语故事】东晋初年,很有名望的尚书仆射周顗为人特别谦虚。 人们总喜欢把他与当时同样有名望的尚书令乐广相提并论,说他们两人都是才学过人、德高望重。 周顗谦虚地说:“把我与他相比,是亵渎了他,那是刻画无盐、唐突西施了。 【典故】庚亮尝谓顗曰:‘诸人咸以君方乐广。 ’顗曰:‘何乃刻画无盐,唐突西施也。 ’《晋书·周顗传》【释义】刻画:描绘;无盐:战国时齐国的丑女;

相关文档
最新文档