SAS Quiz 3

5.0(1)
studied byStudied by 16 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/59

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

60 Terms

1
New cards

When does a data step end?

ch. 10.

When any data set reaches an end of file, the DATA step ends

2
New cards

when merging two data sets you can use the RENAME= data set option to

ch. 10.

rename the variables you are trying to link the observations

3
New cards

SAS will only merge a data set when the

ch.10

BY variable in both data set are the same type

4
New cards

When merging two data sets what occurs if one of the data sets has ID as a character and other has ID as a numeric

ch.10

We then must either convert the numeric to a character variable or the character to a numeric

5
New cards

Can we convert the type of a variable in SAS?

ch.10

No we cannot convert the type of a variable in SAS

6
New cards

We cannot convert the type of a variable in SAS but we can…

ch. 10

create a new variable that has a different type using the old variable

7
New cards

We can convert a character to a numeric using the…

ch.10

INPUT function

8
New cards

We can convert a numeric to a character using…

ch.10

the PUT function

9
New cards

Describe a one-to-many merge

ch.10

If we have one data set with one observation for each BY variable and the other with multiple observations, we can do a one-to-many merge

10
New cards

If you have two data sets that contain the same variables and do a merge, what happens?

ch.10

Values in the second data set overwrite values in the first data set

11
New cards

If the value in the second data set is missing, it will still

ch. 10

overwrite the first data sets value

12
New cards

What does an Update statement do?

ch. 10

Replace values in a data set

13
New cards

What occurs with missing values and an UPDATE statement

ch. 10

overwrite a previous value

14
New cards

What is a SAS function?

ch. 11

A component of the SAS programming language that can accept arguments, perform a computation or other operation, and returns a value

15
New cards

Describe the ROUND function

ch. 11

used to round number to the nearest integer, and you may change the rounding unit

16
New cards

Describe the INT function

ch. 11

returns the integer portion of the number

17
New cards

Describe the FLOOR function

ch. 11

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

18
New cards

The CEIL function

ch. 11

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

19
New cards

You can refer to a missing numeric value with a…

You can refer to a missing character value with a…

ch. 11

period and a missing character value by a single blank space inside quotes

20
New cards

What does the MISSING function do?

ch. 11

Returns a value of true if the argument is a missing value- works with numeric and character variables

21
New cards

What can you use to set values to missing?

ch. 11

a CALL routine, CALL Missing

22
New cards

What are CALL routines used to do?

ch. 11

Used to alter variables values

23
New cards

Name 3 differences between a CALL routine and a function

ch. 11

Functions can accept arguments and returns a single value

The arguments in a CALL routine can have their value changed

CALL routines cannot be used in an assignment statement

24
New cards

Name the functions part of descriptive statistics functions.

ch. 11

  1. MEAN function

  2. SUM function

  3. MAX/MIN function

  4. LARGEST/SMALLEST function

  5. N function

  6. NMISS function

25
New cards

What does the mean function do?

ch. 11

calculate the mean of a set of values

26
New cards

Describe what the SUM function does

ch. 11

sums a group of values

27
New cards

Describe the MAX/MIN function

ch. 11

returns the largest/smallest value

28
New cards

Describe the LARGEST/SMALLEST function

ch. 11

returns the nth largest/smallest value in a group of values

LARGEST (2, of Q1-Q10); returns the 2nd largest value

29
New cards

Describe the N function

ch. 11

Returns the number of non- missing values

30
New cards

Missing values are ignored for which funtions?

ch. 11

MEAN and SUM function

31
New cards

If all values supplied to sum are missing, what occurs?

ch. 11

The default value is missing

32
New cards

Write the code for if we had a variable A1-A10 and B1-B10 and we want to sum and we want the sum to be 0 if all are missing

ch. 11

sumAB = sum (0, of A1-A10, of B1-B10);

33
New cards

Name the SAS functions for common mathematical functions

ch. 11

  1. ABS (Absolute value)

  2. SQRT (square root)

  3. EXP (exponentiation)

  4. LOG (natural log)

34
New cards

What does @@ keep SAS from doing? ch. 11

Keeps SAS from moving to the next line of the data set at the bottom of a DATA step

35
New cards

Recalls @ holds the line for another INPUT statement in the DATA step, but will… ch. 11

move to the next line at the bottom of the DATA step

36
New cards

When X is negative what occurs with the square root and natural log? ch. 11

The square root and natural log are missing

37
New cards

Describe the constant function ch. 11

Returns value of common mathematical constants such as pi and e

Also compute the largest integer that can be stored in a specific number of bytes

38
New cards

What is the RAND function used to doing? ch. 11

Generating random numbers from common probability distributions

39
New cards

Name three things that the RAND function is useful for doing? ch. 11

Useful for conducting simulation studies

Selecting random samples

Assigning subjects randomly to groups

40
New cards

Computers are not capable of doing what? What are they capable of doing? ch. 11

producing truly random numbers. Capable of producing pseudo-random numbers that approximate the properties of a random number.

41
New cards

In the RAND function, what determines the starting point for the random number generator

The RAND function provides a seed number which determines the starting point for the random number generator

42
New cards

If you generate a sequence of random numbers in the same way using the same seed what occurs?

ch. 11

You will generate the same sequence every time

43
New cards

Name and list the probability distributions that SAS can generate random numbers from ch. 11

Uniform

X=rand (ā€˜uniform’);

Uniform number between 0 and 1

Normal
X = rand(ā€˜normal’, 10, 2);
Normally distributed with mean 10 and a standard deviation of 2

Bernoulli
X = rand(ā€˜bernoulli’, 0.5);
Probability of success given by 0.5

Binomial
X = rand(ā€˜binomial’, 0.3, 10);
Number of successes in 10 trials with probability of success given by 0.3


44
New cards

Call streaminit (n) is used to…

ch.11

set random seed to n

45
New cards

If we want to do a random subset such as select 10% of the observations in the heart disease data set we can do this using…

ch.11

an IF statement with the RAND function

46
New cards

If you want exactly of a percent, if we want to select exactly 10%

ch.11

we can use PROC SURVEYSELECT

47
New cards

What does INPUT function allow you

ch.11

to read a character value using an informat and assign the resulting value to a SAS numeric variable

May be also used to convert a date saved as a character to a SAS date value

48
New cards

Since we can’t convert a variable, if we want the new variables to have the same name, what do we need to do?

ch.11

rename the initial variables

49
New cards

What does the PUT function do? It is often used to do what?

ch.11

takes a value, formats the value using the supplied format, and writes the results to a variable

Often used to convert a numeric variable to a character variable

50
New cards

The result of a PUT function is

ch.11

always a character value

51
New cards

Why is it difficult for SAS to compute a value for the present observation that uses a value from a previous observation?

ch.11

Because SAS processes data sets observation by observation

52
New cards

Describe what the LAG function does

ch.11

LAG function returns the value of the argument the last time it was executed

can be used to get value from previous observation

53
New cards

LagN can be used to…

ch.11

return the value N times before it was last executed

54
New cards

When do you need to be careful using the LAG function?

ch.11

When you are using it conditionally

55
New cards

What is the DIF function equal to?

ch.11

X-LAG (X)

56
New cards

What is the DifN function used to do..

What is it equal to?

ch.11

calculate differences to earlier observations

equivalent to X-LagN(X)

57
New cards

What does CALL SORTN routine do?

sorts and returns the arguments in ascending order

58
New cards

Suppose x1=7, x2= ., x3=3, and x4=9

Describe the what CALL SORTN would result in

CALL SORTN (of x1-x4); would result in x1=., x2=3, x3=7, x4=9

59
New cards

Suppose you have Suppose x1=7, x2= ., x3=3, and x4=9

How would you sort them in descending order using CALL SORTN?

What would we would lose?

CALL SORTN (x4-x1);

We would lose the original values of the variables after using CALL SORTN

60
New cards

What can we do if we want to keep both original variables?

We can copy the original variables to a new set of variables that we sort using CALL SORTN if we want to keep both