Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Eviews5 / EViews5 / Docs / EViews 5 Command Ref.pdf
Скачиваний:
47
Добавлен:
23.03.2015
Размер:
5.23 Mб
Скачать

@eqna—599

@dtoo

Date Function | String Function

 

 

Syntax:

@dtoo(str)

Argument:

string, str

Return:

integer

Date-TO-Observation. Returns the observation number corresponding to the date contained in the string. The observation number is relative to the start of the current workfile range, not the current sample. Observation numbers may be used to select a particular element in a vector that has been converted from a series, provided that NAs are preserved (see stomna (p. 627)).

Examples:

scalar obnum = @dtoo("1994:01")

vec1(1) = gdp(@dtoo("1955:01")+10)

Suppose that the workfile contains quarterly data. Then the second example places the 1957:02 value of the GDP series in the first element of VEC1.

Note that @DTOO will generate an error if used in a panel structured workfile.

See also @otod (p. 605).

@eqna

String Function

 

 

Syntax:

@eqna(str1, str2)

Argument 1:

string, str1

Argument 2:

string, str2

Return:

integer

Tests for equality of str1 and str2, treating null strings as ordinary blank strings, and not as missing values. Strings which test as equal return a 1, and 0 otherwise.

Example:

@eqna("abc", "abc")

returns a 1, while

@eqna("", "def")

returns a 0.

600—Appendix F. String and Date Function Reference

See also @isempty (p. 601) and @neqna (p. 604).

@insert

String Function

 

 

Syntax:

@insert(str1, str2, n])

Argument 1:

string, str1

Argument 2:

string, str2

Argument 3:

integer, n

Return:

string

Inserts the string str2 into the base string str1 at the position given by the integer n.

Example:

@insert("I believe it can be done", "not ", 16)

returns “I believe it cannot be done”.

See also @replace (p. 605), @instr (p. 600) and @mid (p. 603).

@instr

String Function

 

 

Syntax:

@instr(str1, str2[, n])

Argument 1:

string, str1

Argument 2:

string, str2

Argument 3:

integer, n

Return:

string

Finds the starting position of the target string str2 in the base string str1. By default, the function returns the location of the first occurrence of str2 in str1. You may provide an optional integer n to change the occurrence. If the occurrence of the target string is not found, @INSTR will return a 0.

Example:

@instr("1.23415", "34")

return the value 4, since the substring “34” appears beginning in the fourth character of the base string.

See also @mid (p. 603).

@left—601

@isempty

String Function

 

 

Syntax:

@isempty(str)

Argument:

string, str

Return:

integer

Tests for whether str is a blank string, returning a 1 if str is a null string, and 0 otherwise.

Example:

@isempty("1.23415")

returns a 0, while

@isempty("")

return the value 1.

See also @len, @length (p. 602).

@left

String Function

 

 

Syntax:

@left(str, n)

Argument 1:

string, str

Argument 2:

integer, n

Return:

string

Returns a string containing n characters from the left end of str. If the string is shorter than n characters, this function returns all of the characters in the source string.

Example:

scalar sc1 = @left("I did not do it",5)

returns “I did”.

See also @right (p. 606), and @mid (p. 603).

602—Appendix F. String and Date Function Reference

@len, @length

String Function

 

 

Syntax:

@len(str), @length(str)

Argument:

string, str

Return:

integer

Returns an integer value for the length of the string str.

Example:

@length("I did not do it")

returns the value 15.

See also @mid (p. 603).

@lower

String Function

 

 

Syntax:

@lower(str)

Argument:

string, str

Return:

string

Returns the lowercase representation of the string str.

Example:

@length("I did NOT do it")

returns the string “i did not do it”.

See also @upper (p. 608).

@ltrim

String Function

 

 

Syntax:

@ltrim(str)

Argument:

string, str

Return:

string

Returns the string str with spaces trimmed from the left.

Example:

Соседние файлы в папке Docs