SAS Quiz 3

studied byStudied by 16 people
5.0(1)
Get a hint
Hint

When does a data step end?

ch. 10.

1 / 59

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

60 Terms

1

When does a data step end?

ch. 10.

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

New cards
2

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

New cards
3

SAS will only merge a data set when the

ch.10

BY variable in both data set are the same type

New cards
4

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

New cards
5

Can we convert the type of a variable in SAS?

ch.10

No we cannot convert the type of a variable in SAS

New cards
6

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

New cards
7

We can convert a character to a numeric using theā€¦

ch.10

INPUT function

New cards
8

We can convert a numeric to a character usingā€¦

ch.10

the PUT function

New cards
9

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

New cards
10

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

New cards
11

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

ch. 10

overwrite the first data sets value

New cards
12

What does an Update statement do?

ch. 10

Replace values in a data set

New cards
13

What occurs with missing values and an UPDATE statement

ch. 10

overwrite a previous value

New cards
14

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

New cards
15

Describe the ROUND function

ch. 11

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

New cards
16

Describe the INT function

ch. 11

returns the integer portion of the number

New cards
17

Describe the FLOOR function

ch. 11

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

New cards
18

The CEIL function

ch. 11

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

New cards
19

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

New cards
20

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

New cards
21

What can you use to set values to missing?

ch. 11

a CALL routine, CALL Missing

New cards
22

What are CALL routines used to do?

ch. 11

Used to alter variables values

New cards
23

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

New cards
24

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

New cards
25

What does the mean function do?

ch. 11

calculate the mean of a set of values

New cards
26

Describe what the SUM function does

ch. 11

sums a group of values

New cards
27

Describe the MAX/MIN function

ch. 11

returns the largest/smallest value

New cards
28

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

New cards
29

Describe the N function

ch. 11

Returns the number of non- missing values

New cards
30

Missing values are ignored for which funtions?

ch. 11

MEAN and SUM function

New cards
31

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

ch. 11

The default value is missing

New cards
32

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);

New cards
33

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)

New cards
34

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

New cards
35

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

New cards
36

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

The square root and natural log are missing

New cards
37

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

New cards
38

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

Generating random numbers from common probability distributions

New cards
39

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

New cards
40

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.

New cards
41

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

New cards
42

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

New cards
43

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


New cards
44

Call streaminit (n) is used toā€¦

ch.11

set random seed to n

New cards
45

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

New cards
46

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

ch.11

we can use PROC SURVEYSELECT

New cards
47

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

New cards
48

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

New cards
49

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

New cards
50

The result of a PUT function is

ch.11

always a character value

New cards
51

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

New cards
52

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

New cards
53

LagN can be used toā€¦

ch.11

return the value N times before it was last executed

New cards
54

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

ch.11

When you are using it conditionally

New cards
55

What is the DIF function equal to?

ch.11

X-LAG (X)

New cards
56

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)

New cards
57

What does CALL SORTN routine do?

sorts and returns the arguments in ascending order

New cards
58

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

New cards
59

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

New cards
60

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

New cards

Explore top notes

note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 136 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 26 people
Updated ... ago
5.0 Stars(3)
note Note
studied byStudied by 10 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)

Explore top flashcards

flashcards Flashcard135 terms
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard100 terms
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard25 terms
studied byStudied by 35 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard21 terms
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard46 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard40 terms
studied byStudied by 180 people
Updated ... ago
4.7 Stars(3)
flashcards Flashcard20 terms
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard24 terms
studied byStudied by 27 people
Updated ... ago
5.0 Stars(1)