T/F: SAS converts all dates to equal the number of days from January 1, 1960
True
T/F: The today() function in SAS returns the current day's date.
True
Which of the following statements correctly computes *Age* in years at time of visit, given DOB and VisitDate?
C) Age=yrdif(DOB, VisitDate);
The YRDIF function computes the difference in years between two dates
Which program reads two data sets named FACULTY and STAFF and writes them to a new (combined) data set called DIRECTORY?
B) data directory; set faculty staff; run;
What must be true before two data sets can be merged in SAS using a by statement?
D) The two data sets must be sorted according to the variable in the BY statement
When merging with a by statement, SAS requires the individual data sets to be sorted first, according the variable in the BY statement. That variable is common to the individual data sets
Which program reads two data sets named DAILY_TEMPERATURE and DAILY_RAIN and writes them to a new (combined) data set called WEATHER using the merge statement?
C) data WEATHER; merge DAILY_TEMPERATURE DAILY_RAIN; by date_value; run;
What variable is the data set sorted by in this proc sort?
proc sort data=business;
by department;
run;
D) department
If the dataset marbles contains the variables red, blue, orange, and yellow, what variables will be in the dataset games after the following code has run?
data games;
set marbles;
keep red yellow;
run;
D) red and yellow
If the dataset marbles contains the variables red, blue, orange and yellow, what variables will be in the dataset games after the following code has run?
data games(drop=red blue orange);
set marbles;
run;
B) yellow
If the dataset marbles contains the variables red, blue, orange, yellow what variables will be in the dataset games after the following code has run?
data games(rename=(blue=navy));
set marbles;
run;
A) red, orange, yellow and navy
Before combining data sets, what must be done first?
sort the data using PROC SORT
What are the two ways we learned to combine datasets in SAS
Using the SET statement
Using a MERGE statement
What happens when the SET statement is used to combine data?
observations are stacked on top of each other
The two datasets being combined do not need to have the same set of variables, but variables of the same name should be of the same type (i.e. character or numeric)
How is variable length determined when combining data using SET?
each variable has the length of the first dataset the variable appeared in
What proc step is needed for the datastep merge?
Proc Sort
sort data by a specific variable
if you want to sort highest to lowest, the keyword DESCENDING needs to be put before the variable
proc sort data=work.data;
by descending weight length1;
run;
How does SAS store dates?
SAS stores all dates as numbers, specifically the number of days since January 1, 1960
How do each of these formats modify the date March 25, 2019?
mmddyy10=
mmddyy8=
date9=
mmddyy10= 03/25/2019
mmddyy8= 03/25/19
date9=25Mar2019
Which function computes the number of years between two dates?