1/59
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
When does a data step end?
ch. 10.
When any data set reaches an end of file, the DATA step ends
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
SAS will only merge a data set when the
ch.10
BY variable in both data set are the same type
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
Can we convert the type of a variable in SAS?
ch.10
No we cannot convert the type of a variable in SAS
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
We can convert a character to a numeric using theā¦
ch.10
INPUT function
We can convert a numeric to a character usingā¦
ch.10
the PUT function
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
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
If the value in the second data set is missing, it will still
ch. 10
overwrite the first data sets value
What does an Update statement do?
ch. 10
Replace values in a data set
What occurs with missing values and an UPDATE statement
ch. 10
overwrite a previous value
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
Describe the ROUND function
ch. 11
used to round number to the nearest integer, and you may change the rounding unit
Describe the INT function
ch. 11
returns the integer portion of the number
Describe the FLOOR function
ch. 11
returns the largest integer that is less than or equal to the argument
The CEIL function
ch. 11
returns the smallest integer that is greater than or equal to the argument
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
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
What can you use to set values to missing?
ch. 11
a CALL routine, CALL Missing
What are CALL routines used to do?
ch. 11
Used to alter variables values
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
Name the functions part of descriptive statistics functions.
ch. 11
MEAN function
SUM function
MAX/MIN function
LARGEST/SMALLEST function
N function
NMISS function
What does the mean function do?
ch. 11
calculate the mean of a set of values
Describe what the SUM function does
ch. 11
sums a group of values
Describe the MAX/MIN function
ch. 11
returns the largest/smallest value
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
Describe the N function
ch. 11
Returns the number of non- missing values
Missing values are ignored for which funtions?
ch. 11
MEAN and SUM function
If all values supplied to sum are missing, what occurs?
ch. 11
The default value is missing
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);
Name the SAS functions for common mathematical functions
ch. 11
ABS (Absolute value)
SQRT (square root)
EXP (exponentiation)
LOG (natural log)
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
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
When X is negative what occurs with the square root and natural log? ch. 11
The square root and natural log are missing
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
What is the RAND function used to doing? ch. 11
Generating random numbers from common probability distributions
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
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.
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
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
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
Call streaminit (n) is used toā¦
ch.11
set random seed to n
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
If you want exactly of a percent, if we want to select exactly 10%
ch.11
we can use PROC SURVEYSELECT
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
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
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
The result of a PUT function is
ch.11
always a character value
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
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
LagN can be used toā¦
ch.11
return the value N times before it was last executed
When do you need to be careful using the LAG function?
ch.11
When you are using it conditionally
What is the DIF function equal to?
ch.11
X-LAG (X)
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)
What does CALL SORTN routine do?
sorts and returns the arguments in ascending order
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
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
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