Using SAS Functions

advertisement

SAS Programming

North Carolina Virtual Public Schools

ECPRG2 Modules 4: Manipulating Character Values

Guided Notes

Using SAS Functions

1.

What is a SAS function?

2.

What is the basic syntax?

3.

What is an argument?

4.

What is a target variable?

5.

What determines the data type and length of the target variable?

Extracting and Transforming Character Values

6.

Complete the following table.

Function

SUBSTR

LENGTH

RIGHT

LEFT

Purpose

CHAR

PROPCASE

7.

What is the syntax of the SUBSTR function?

8.

What happens if the length of the values vary in the variable when using the SUBSTR function?

9.

What is the syntax of the LENGTH function?

10.

How would you use the SUBSTR and LENGTH function together to subset the data and extract a string?

11.

What is the syntax of the RIGHT function?

12.

How does the RIGHT function handle trailing blanks?

13.

What is the syntax of the LEFT function?

14.

How does the LEFT function handle trailing blanks?

15.

What is the syntax of the CHAR function?

16.

What does the CHAR function do?

17.

What is the syntax of the PROPCASE function?

18.

What are the default delimiters?

19.

How can you handle multiple delimiters?

20.

Define LOWCASE and UPCASE functions?

Separating and Concatenating Character Values

21.

Why might you not want to use a SUBSTR function to separate a string into two parts?

22.

Complete the following table.

Function

SCAN

CATX

TRIM

STRIP

CAT, CATT, CATS

Purpose

23.

Describe the SCAN function. (When to use, Syntax, How it works.)

24.

What is the impact of having more than one delimiter separating the values?

25.

When should you use SCAN versus SUBSTR?

26.

Describe the CATX function. (When to use, Syntax, How it works.)

27.

What is the default length of the variable when using the CATX function? How can you override this length?

28.

Describe the concatenation operator (||, !!). (When to use, Syntax, How it works.)

29.

What determines the length of the new variable when using concatenation operators?

30.

Describe the TRIM function. (When to use, Syntax, How it works.)

31.

Describe the STRIP function. (When to use, Syntax, How it works.)

32.

Describe the CAT, CATT, CATS functions. (When to use, Syntax, How it works.)

Finding and Modifying Character Values

33.

Complete the table.

Function

FIND

Purpose

TRANWRD

PROPCASE

COMPRESS

34.

Describe the FIND function. (When to use, Syntax, How it works, What are the modifiers/start values.)

35.

Describe using the SUBSTR function on the left side of the assignment statement. (When to use, Syntax, How it works.)

36.

Describe the TRANWRD function. (When to use, Syntax, How it works.)

37.

Describe the COMPRESS function. (When to use, Syntax, How it works.)

Review

Default Delimiters in SAS

Download