SAS Base Exam
<inset code> proc means data=sasuser.shoes; where product in ('sandal', 'slipper', 'boot'); run; <insert code> A. pdf open file='sales.pdf'; pdf close; B. ods pdf file='sales.pdf'; ods pdf close; C. ods pdf open 'sales.pdf'; ods pdf close; D. pdf open 'sales.pdf' ods pdf close;
A
A raw data record is shown below: 07Jan2002 Which one of the following informats would read this value and store it as a SAS date value? A. date9. B. ddmonyy9. C. ddMMMyy9. D. ddmmmyyyy9.
A
Consider the data step: data work.test; infile 'C:\class1.csv' dsd; input Name $ Sex $ Age Height Weight; if Age NE 16 and AGe NE 15 then Group=1; else Group=2; Which of the following assignment statements for variable group are functionally equivalent to the original statement used in the above data step? A. if Age not in(15,16) then Group=1; else Group=2; B. if (Age NE 16) or (Age NE 15) then Group=1; else Group=2; C. where Age not between 15 and 16 then Group=1; else Group=2; D. both A or C will work.
A
Consider the following data step: Data work.new; se work.old (keep=X) esle if X >= 10 and X LT 20 then X=2; Else X=3; run; In filtering the values of the variable X in data set WORK.OLD, what value new value would be assigned to X if its original value was a missing value? A. X would get a value of 1. B. X would get a value of 3. C. X would retain its original value of missing. D. This step does not run because of syntax errors.
A
The Excel workbook QTR1.XLS contains the following three worksheets: JAN FEB MAR Which statement correctly assigns a library reference to the Excel workbook? A. libname qtrdata 'qtr1.xls'; B. libname 'qtr1.xls' sheets=3; C. libname jan feb mar 'qtr1.xls'; D. libname mydata 'qtr1.xls' WORK.heets=(jan,feb,mar);
A
The contents of two SAS data sets named EMPLOYEE and SALARY are listed below: data emplsal; merge employee (in=ine) salary(in=ins); by name; if ine and ins; run; How many observation are in EMPLSAL dataset? A. 4 B. 3 C. 2 D. 1
A
The following SAS program is submitted: data WORK.DATE_INFO; Month="01″ ; Yr=1960 ; X=mdy(Month,01,Yr) ;run; What is the value of the variable X? A. the numeric value 0 B. the character value "01011960" C. a missing value due to syntax errors D. the step will not compile because of the character argument in the mdy function.
A
The following SAS program is submitted: data WORK.TEST; set WORK.MEASLES(keep=Janpt Febpt Marpt); array Diff{3} Difcount1-Difcount3; array Patients{3} Janpt Febpt Marpt; run; What new variables are created? A. Difcount1, Difcount2 and Difcount3 B. Diff1, Diff2 and Diff3 C. Janpt, Febpt, and Marpt D. Patients1, Patients2 and Patients3
A
The following SAS program is submitted: data WORK.TOTAL; set WORK.SALARY; by Department Gender; if First.<_insert_code_> then Payroll=0;Payroll+Wagerate; if Last.<_insert_code_>; run; The SAS data set WORK.SALARY is currently ordered by Gender within Department. Which inserted code will accumulate subtotals for each Gender within Department? A. Gender B. Department C. Gender Department D. Department Gender
A
The following SAS program is submitted: data _null_; set old; put sales1 sales2; run; Where is the output written? A. the SAS log B. the raw data file that was opened last C. the SAS output window or an output file D. the data set mentioned in the DATA statement
A
There are 451 observations in the data set WORK.STAFF.The following SAS program is submitted: data work.one; set work.staff end = eof; Newvar = eof; run; What will be the value of NewVar when SAS writes the last observation? A. 451 B. 1 C. 0 D. . (a missing value)
A
Which variables and data values are used to calculate statistics in the MEANS procedure? By default, which variables and data values are used to calculate statistics in the MEANS procedure? A. all non-missing numeric variable values B. all missing and non-missing numeric variable values and numbers stored as character variables. C. all non-missing numeric variable values and numbers stored as character variables D. all missing and non-missing numeric variable values
A
What are the two types of steps? Select one: a. DATA and PROC Correct b. RUN and QUIT c. CHARACTER and NUMERIC d. DATA and DESCRIPTOR
A The two types of SAS steps are DATA and PROC. Character and numeric are the two SAS data types, RUN and QUIT are the two explicity step boundaries and the two parts of a data set include the DATA and DESCRIPTOR portions. The correct answer is: DATA and PROC
Examine the SAS log shown below: 1 proc print data=sashelp.snacks; 2 var Product Price QtySold 3 run; ERROR: Variable RUN not found. What type of error message is displayed? Select one: a. logic error b. syntax error Correct c. run-time error d. PROC error
A syntax error message is written to the log when the programming statements do not conform to the rules of the SAS language. Leaving off the semicolon for the VAR statement is considered a syntax error. The correct answer is: syntax error
The following SAS SORT procedure step generates an output data set: proc sort data = sasuser.houses out = report; by style;run; In which library is the output data set stored?A.WORK B.REPORT. C.HOUSES D.SASUSER
A. If library name is not specified then the data will be stored in temporary dataset i.e. WORK.
What does data _null_ mean? data _null_ ; This statement produces: A. no SAS dataset B. a SAS dataset named null C. a SAS dataset named _null_ D. the largest possible dataset
A. The data _null_ does not produce a dataset. It is used mainly for the following purposes : 1. To create macro variables with call symput 2. To create customized reports with PUT statements writing to external files.
The contents of the raw data file NAMENUM are listed below: --------10-------20-------30 Joe xx The following SAS program is submitted: data test; infile 'namenum'; input name $ number; run; Which one of the following is the value of the NUMBER variable? A. xx B. Joe C. . (missing numeric value) D. The value can not be determined as the program fails to execute due to errors.
Answer : C. It is because number is defined as a numeric variable so it is expecting a numeric value but it reads xx, so number will be a missing value.
The following SAS program is submitted: data test; set sasuser.employees; if 2 le years_service le 10 then amount = 1000; else if years_service gt 10 then amount = 2000; else amount = 0; amount_per_year = years_service / amount; run; Which one of the following values does the variable AMOUNT_PER_YEAR contain if an employee has been with the company for one year? A. 0 B. 1000 C. 2000 D. . (missing numeric value)
Answer : D (missing). It returns missing value as amount will be 0. SAS Log: NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.
A user-defined format has been created using the FORMAT procedure.How is it stored? A. in a SAS catalog B. in a memory resident lookup table C. in a SAS dataset in the WORK library D. in a SAS dataset in a permanent SAS data library
Answer: A
Given the raw data record in the file phone.txt: ----|----10---|----20---|----30---|Stevens James SALES 304-923-3721 14 The following SAS program is submitted: data WORK.PHONES; infile 'phone.txt'; input EmpLName $ EmpFName $ Dept $ Phone $ Extension;<_insert_code_>run; Which SAS statement completes the program and results in a value of "James Stevens" for the variable FullName? A. FullName=CATX(' ',EmpFName,EmpLName); B. FullName=CAT(' ',EmpFName,EmpLName); C. FullName=EmpFName||EmpLName; D. FullName=EmpFName + EmpLName;
Answer: A
The following SAS program is submitted: data ONE TWO SASUSER.TWO; set SASUSER.ONE; run; Assuming that SASUSER.ONE exists, how many temporary and permanent SAS data sets are created? A. 2 temporary and 1 permanent SAS data sets are created B. 3 temporary and 2 permanent SAS data sets are created C. 2 temporary and 2 permanent SAS data sets are created D. there is an error and no new data sets are created
Answer: A
The following SAS program is submitted: data WORK.TOTALSALES(keep=MonthSales{12}); set WORK.MONTHLYSALES(keep=Year Product Sales); array MonthSales{12}; do i=1 to 12;MonthSales{i}=Sales; end; drop i; run; The program fails execution due to syntax errors.What is the cause of the syntax error? A. An array cannot be referenced on a keep= data set option. B. The keep= data set option should be (keep=MonthSales*). C. The keep= data set option should be the statement KEEP MonthSales{12}. D. The variable MonthSales does not exist.
Answer: A
The following SAS program is submitted: data WORK.DATE_INFO; X="01Jan1960″D ; run; Variable X contains what value? A. the numeric value 0 B. the character value "01Jan1960" C. the date value 01011960 D. the code contains a syntax error and does not execute.
Answer: A 注解:Letter D is used to convert a normal date in DDMMMYY or DDMMMYYYY format to SAS date value. Check SAS Base (16) for details. This question has another version. A space is placed between the closing quotation mark and letter D. This will cause a compile error and the answer would be D.
The SAS data set Fed.Banks contains a variable Open_Date which has been assigned a permanent label of "Open Date". Which SAS program temporarily replaces the label "Open Date" with the label "Starting Date" in the output? A.proc print data=SASUSER.HOUSES label;label Open_Date "Starting Date";run; B.proc print data=SASUSER.HOUSES label;label Open_Date="Starting Date";run; C.proc print data=SASUSER.HOUSES;label Open_Date="Starting Date";run; D.proc print data=SASUSER.HOUSES;Open_Date="Starting Date";run;
Answer: B
The following SAS program is submitted: data WORK.AUTHORS; array Favorites{3} $ 8 ('Shakespeare','Hemingway','McCaffrey'); run; What is the value of the second variable in the dataset WORK.AUTHORS? A. Hemingway B. Hemingwa C. ' ' (a missing value) D. The program contains errors. No variables are created.
Answer: B
The following SAS program is submitted: data WORK.INFO; infile 'DATAFILE.TXT'; input @1 Company $20. @25 State $2. @; if State=' ' then input @30 Year; else input @30 City Year; input NumEmployees; run; How many raw data records are read during each iteration of the DATA step? A. 1 B. 2 C. 3 D. 4
Answer: B
The following SAS program is submitted: data WORK.PRODUCTS; Prod=1; do while(Prod LE 6); Prod + 1; end; run; What is the value of the variable Prod in the output data set? A. 6 B. 7 C. 8 D. . (missing numeric)
Answer: B
The following SAS program is submitted: data WORK.TEST; set WORK.PILOTS; if Jobcode='Pilot2′ then Description='Senior Pilot'; else Description='Unknown'; run;
Answer: B
The following SAS program is submitted: ods csvall file='c:test.csv'; proc print data=WORK.ONE; var Name Score Grade; by IdNumber; run; ods csvall close; What is produced as output? A. A file named test.csv that can only be opened in Excel. B. A text file named test.csv that can be opened in Excel or in any text editor. C. A text file named test.csv that can only be opened in a text editor. D. A file named test.csv that can only be opened by SAS.
Answer: B
You're attempting to read a raw data file and you see the following messages displayed in the SAS Log: NOTE: Invalid data for Salary in line 4 15-23.RULE: ----|----10---|----20---|----30---|----40---|----50- 4 120104 F 46#30 11MAY1954 33 Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061 _ERROR_=1 _N_=4 NOTE: 20 records were read from the infile 'c:employees.dat'. The minimum record length was 33. The maximum record length was 33. NOTE: The data set WORK.EMPLOYEES has 20 observations and 4 variables. What does it mean? A. A compiler error, triggered by an invalid character for the variable Salary. B. An execution error, triggered by an invalid character for the variable Salary. C. The 1st of potentially many errors, this one occurring on the 4th observation. D. An error on the INPUT statement specification for reading the variable Salary.
Answer: B
Given the SAS data set WORK.ONE: N BeginDate 10 9JAN2012 12 JAN201 The following SAS program is submitted: data WORK.TWO; set WORK.ONE; Day=<_insert_code_>; format BeginDate date9.; run; The data set WORK.TWO is created, where Day would be 1 for Sunday, 2 for Monday, 3 for Tuesday, ... : N BeginDate Day 10 9JAN2010 7 2 12JAN2010 3 Which expression successfully completed the program and creates the variable Day? A. day(BeginDate) B. weekday(BeginDate) C. dayofweek(BeginDate) D. getday(BeginDate,today())
Answer: B 注解:WEEKDAY function returns an integer that corresponds to the day of the week, where 1=Sunday, 2=Monday, ..., 7=Saturday, from a SAS date value. DAY function returns the day of the month. There is no function called DAYOFWEEK or GETDAY in SAS.
The following SAS program is submitted: data WORK.TOTAL_SALARY; retain Total; set WORK.SALARY; by Department; if First.Department then Total=0; Total=sum(Total, Wagerate); if Last.Total; run; What is the initial value of the variable Total? A. 0 B. Missing C. The value of the first observations Wagerate D. Cannot be determined from the information given
Answer: B The second line of codes, retain Total, initializes the variable Total. As it doesn't specify an initial value, a missing value is assigned to the variable. Please also check SAS Base (32) for the details of RETAIN statement.
Consider the following data step: data WORK.NEW; set WORK.OLD; Count+1; run; The variable Count is created using a sum statement. Which statement regarding this variable is true? A. It is assigned a value 0 when the data step begins execution. B. It is assigned a value of missing when the data step begins execution. C. It is assigned a value 0 at compile time. D. It is assigned a value of missing at compile time.
Answer: C
Which TABLES option(s) would be used to eliminate the row and column counts and just see the frequencies and percents? A. norowcount nocolcount B. freq percent C. norow nocol D. nocounts
Answer: C
A programmer would like to create a new variable, ship_note,that shows a character value with the order_id,shipped date, and customer name. For example, given the first observation ship_note would have the value "Order 9341 shipped on 02FEB2009 to Josh Martin". Which of the following statement will correctly create the value and assign it to ship_note? A. ship_note=catx(' ','Order',order_id,'shipped on',input(shipped,date9.),'to',customer); B. ship_note=catx(' ','Order',order_id,'shipped on',char(shipped,date9.),'to',customer); C. ship_note=catx(' ','Order',order_id,'shipped on',tranwrd(shipped,date9.),'to',customer); D. ship_note=catx(' ','Order',order_id,'shipped on',put(shipped,date9.),'to',customer);
Answer: D
The following SAS program is submitted: data WORK.ONE; Text='Australia, US, Denmark'; Pos=find(Text,'US','i',5); run; What value will SAS assign to Pos? A. 0 B. 1 C. 2 D. 12
Answer: D
Consider the following data step: data WORK.TEST; set SASHELP.CLASS(obs=5); retain City 'Beverly Hills'; State='California'; run; The computed variables City and State have their values assigned using two different methods, a RETAIN statement and an Assignment statement. Which statement regarding this program is true? A. The RETAIN statement is fine, but the value of City will be truncated to 8 bytes as the LENGTH statement has been omitted. B. Both the RETAIN and assignment statement are being used to initialize new variables and are equally efficient. Method used is a matter of programmer preference. C. The assignment statement is fine, but the value of City will be truncated to 8 bytes as the LENGTH statement has been omitted. D. City's value will be assigned one time, State's value 5 times.
Answer: D 注解:Both RETAIN statement and Assignment (=) statement can be used to assign values, but there are a few differences. 1. As RETAIN statement assigns the value at compile time, the code will be executed once and only once. Assignment statement, however, respecifies the value in every iteration.2. SAS automatically sets variables that are assigned values by an assignment statement to missing before each iteration of the DATA step. On the contrary, RETAIN statement retains the value from one iteration to the next. AS this program reads the first 5 observations (5 iterations) in CLASS data set, the value of State is specified 5 times, and the variable is reset to missing when SAS begins to read the next observation. City is initialized as 'Beverly Hills' before DATA step and won't be reset to missing.
The following program is submitted: proc contents data=_all_;run; Which statement best describes the output from the submitted program? A. The output contains only a list of the SAS data sets that are contained in the WORK library. B. The output displays only the contents of the SAS data sets that are contained in the WORK library. C. The output displays only the variables in the SAS data sets that are contained in the WORK library. D. The output contains a list of the SAS data sets that are contained in the WORK library and displays the contents of those data sets.
Answer: D The CONTENTS procedure shows the contents of a SAS data set and prints the directory of the SAS library. As the libref is omitted, SAS uses the default library WORK, and _ALL_ represents all data sets in that library. SAS lists the data sets in WORK library followed by the contents of each data set.
Given the data set Work.departments: departments Numpermanent Numtemps Admin 50 5 Education 25 7 Sales 30 5 The following SAS program is submitted: data work.emps; set work.departments; retain TotalEmps; if _N_ = 1 then TotalEmps = 0; else TotalEmps = Numpermanent + Numtemps; run; proc print data = work.emps noobs; run; Which output will be generated? A. Department Numpermanent NumTemps TotalEmps Admin 50 5 55 Education 25 7 87 Sales 30 5 35 B. Department Numpermanent NumTemps TotalEmps Admin 50 5 55 Education 25 7 32 Sales 30 5 35 C. Department Numpermanent NumTemps TotalEmps Admin 50 5 0 Education 25 7 32 Sales 30 5 35 D. Department Numpermanent NumTemps TotalEmps Admin 50 5 0 Education 25 7 32 Sales 30 5 67
B
Given the following SAS program: Proc print data = work.departments <insert option here>; labe dept = 'Department'; EmpID = "Employee*Identification*Number'; run; A. Label = '*' B. labelsplit = '*' C. split = '*' D. wrap = '*'
B
The following SAS program is submitted: Data Work.total_salary; retain total; set work.salary; by department; if first.department then total=0; total=sum(total,wagerate); if last.total; run; What is the initial value of the variable Total in the following program? A. 0 B. Missing C. The value of the first observations Wagerate D. Cannot be determined from the information given
B
The following SAS program is submitted: data WORK.DATE_INFO; X='04jul2005'd; DayOfMonth=day(x); MonthOfYear=month(x); Year=year(x); run; What types of variables are DayOfMonth, MonthOfYear, and Year? A. DayOfMonth, Year, and MonthOfYear are character. B. DayOfMonth, Year, and MonthOfYear are numeric. C. DayOfMonth and Year are numeric. MonthOfYear is character. D. DayOfMonth, Year, and MonthOfYear are date values.
B
Given the SAS data set WORK.PRODUCTS: ProdIdPriceProductTypeSalesReturns K12S95.50OUTDOOR152 B132S2.99CLOTHING30010 R18KY251.99EQUIPMENT255 3KL8BY6.39OUTDOOR12515 DY65DW5.60OUTDOOR455 DGTY2334.55EQUIPMENT672 The following SAS program is submitted: data WORK.OUTDOOR WORK.CLOTH WORK.EQUIP; set WORK.PRODUCTS; if Sales GT 30; if ProductType EQ 'OUTDOOR' then output WORK.OUTDOOR; else if ProductType EQ 'CLOTHING' then output WORK.CLOTH; else if ProductType EQ 'EQUIPMENT' then output WORK.EQUIP; run; How many observations does the WORK.OUTDOOR data set contain?A. 1B. 2C. 3D. 6
B 2
Which of the following is not an error identified during the compilation phase? A) Quotation marks are unbalances B) No RUN statement in the step C) An option is invalid D) Semicolons are missing in statements
B.
The SAS data set EMPLOYEE_INFO is listed below: IDNumber Expenses 2542 100.00 3612 133.15 2198 234.34 2198 111.12 The following SAS program is submitted: proc sort data = employee_info; run; Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value? A. by Expenses IDNumber; B. by IDNumber Expenses; C. by ascending (IDNumber Expenses); D. by ascending IDNumber ascending Expenses;
B. By default SAS will sort data in ascending order. IDNumber should be specified before Expenses as we want IDNUMBER to be sorted in ascending.
How many of the following statistics that PROC MEANS computes as default statistics? Standard deviation RangeCount Minimum valueVariance Mode A. 2 B. 3 C. 4 D. None of the above
B. By default, PROC MEANS calculates count, mean, standard deviation, minimum and maximum value.
Which one of the following is true when SAS encounters a data error in a DATA step? A. The DATA step stops executing at the point of the error, and no SAS data set is created. B. A note is written to the SAS log explaining the error, and the DATA step continues to execute. C. A note appears in the SAS log that the incorrect data record was saved to a separate SAS file for further examination. D. The DATA step stops executing at the point of the error, and the resulting DATA set contains observations up to that point.
B. If it's a syntax error then the A occurs.If it's an error with invalid data then B will occur .If it's a problem with merging two or more datasets, then D will occur.
The following SAS program is submitted:data work.flights; destination = 'CPH'; select(destination); when('LHR') city = 'London'; when('CPH') city = 'Copenhagen'; otherwise; end; run; Which one of the following is the value of the CITY variable? A. London B. Copenh C. Copenhagen D. ' ' (missing character value)
B. Notice that the LENGTH statement in the SELECT group has not been specified. Remember that without the LENGTH statement, values for Group might be truncated, as the first value for Group (London) is not the longest possible value.city = 'London' - It contains 6 characters. 'Copenhagen' will be truncated to 6 characters i..e Copenh.
The following SAS program is submitted: data _null_;set old (keep = prod sales1 sales2); file 'file-specification'; put sales1 sales2; run; Which one of the following default delimiters separates the fields in the raw data file created?A. : (colon) B. (space) C. , (comma) D. ; (semicolon)
B. Since no delimiter is specified at the end of the "file", the default delimiter space will be used.
The SAS data set named WORK.TEST is listed below: Which one of the following SAS programs created this data set?A.data work.test; capacity = 150; if 100 le capacity le 200 thenairplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5;run; B.data work.test;capacity = 150; if 100 le capacity le 200 then do; airplane type = 'Large'; staff = 10; end; elsedo; airplanetype = 'Small'; staff = 5; end; run; C.data work.test; capacity = 150; if 100 le capacity le 200 thendo; airplanetype = 'Large'; staff = 10; elsedo; airplanetype = 'Small'; staff = 5; end; run; D.data work.test; capacity = 150; if 100 le capacity le 200 then; airplanetype = 'Small'; staff = 5;else; airplanetype = 'Large'; staff = 10; run;
B. The problem with the options A,C and D is highlighted below in bold. A. data work.test; capacity = 150; if 100 le capacity le 200 thenairplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5; run; Log : NOTE: Variable staff is uninitialized. C. data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff = 10; else /*end missing for if do loop*/ do; airplanetype = 'Small'; staff = 5; end; run; Log : ERROR 117-185: There was 1 unclosed DO block. NOTE: The SAS System stopped processing this step because of errors. D. data work.test;capacity = 150; if 100 le capacity le 200 then; airplanetype = 'Small'; staff = 5;else; /* there is no if associated with this else */ airplanetype = 'Large'; staff = 10;run; Log : ERROR 160-185: No matching IF-THEN clause
Which one of the following SAS statements renames two variables? A. set work.dept1 work.dept2(rename = (jcode = jobcode) (sal = salary)); B. set work.dept1 work.dept2(rename = (jcode = jobcode sal = salary)); C. set work.dept1 work.dept2(rename = jcode = jobcode sal = salary); D. set work.dept1 work.dept2(rename = (jcode jobcode) (sal salary));
B. The syntax for RENAME is as follows :RENAME=(old-name-1=new-name-1 old-name-2=new-name-2. . . old-name-n=new-name-n)
The following SAS program is submitted: data work.totalsales (keep = monthsales{12} ); set work.monthlysales (keep = year product sales); array monthsales {12} ; do i=1 to 12; monthsales{i} = sales; end; run; The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations. Which one of the following is the result of the above program? A. The program fails execution due to data errors. B. The program fails execution due to syntax errors. C. The program executes with warnings and creates the WORK.TOTALSALES data set. D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
B. The syntax issue lies in this line of code - keep = msales{12} To correct the syntax issue, replace keep = msales{12} with keep = msales1-msales12 See the errors in log window : 153 data work.totalsales(keep = msales{12} ) ; ERROR 214-322: Variable name { is not valid. ERROR 23-7: Invalid value for the KEEP option.
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are listed below: WORK.EMPLOYEE fname age Bruce 30 Dan 40 Dan 25000 WORK.SALARY fname salary Bruce 25000 Bruce 35000 The following SAS program is submitted: data work.empdata; merge work.employee work.salary; by fname; totsal + salary; run;
B. The variables are: Fname, age, salary and totsal.Note: Obs will not be counted here.
In the following SAS program, the input data files are sorted by the NAMES variable: libname temp 'SAS-data-library'; data temp.sales; merge temp.sales work.receipt; by names; run; Which one of the following results occurs when this program is submitted? A. The program executes successfully and a temporary SAS data set is created. B. The program executes successfully and a permanent SAS data set is created. C. The program fails execution because the same SAS data set is referenced for both read and write operations. D. The program fails execution because the SAS data sets on the MERGE statement are in two different libraries.
B. temp is declared as a permanent library so permanent dataset will be created.
The following SAS program is submitted: data work.one; x = 3; y = 2; z = x ** y; run; Which one of the following is the value of the variable Z in the output data set? A. 6 B. 9 C. . (missing numeric value) D. The program fails to execute due to errors.
B.** = exponentiation X**Y raise X to the power of YSo 3 to the power of 2 = 9
The variables in the data set patients are name, height_meters, weight_kg, and age. Which code statement creates the data set underweight such that it contains all the rows of patients with a BMI value less than or equal to 18.5? Select one: a.data underweight; set patients; BMI = weight_kg / height_meters **2; where BMI <= 18.5; run; Incorrect b.data underweight; set patients(if= (BMI <=18.5)); BMI = weight_kg / height_meters **2; run; c.data underweight; set patients(where= (BMI <= 18.5)); BMI = weight_kg / height_meters **2; run; d.data underweight; set patients; BMI = weight_kg / height_meters **2; if BMI <= 18.5; run;
BMI is calculated in the program data vector. The WHERE statement is evaluated before data is loaded into the program data vector. IF= is not a data set option. The subsetting IF statement filters rows by the given condition. The correct answer is: data underweight; set patients; BMI = weight_kg / height_meters **2; if BMI <= 18.5; run;
Which DATA step creates the table shown below? Month Principle 1 250.00 2 250.63 3 251.25 4 251.88 Select one: a. data savings; Month = 1; Principal = 250; format Principal comma10.2; output; Month = Month + 1; Principal = Principal * (1+.03/12); output; Month = Month + 1; Principal = Principal * (1+.03/12); output; Month = Month + 1; Principal = Principal * (1+.03/12); output; run; b. data savings; Month = 1; Principal = 250; format Principal comma10.2; Month = Month + 1; Principal = Principal * (1+.03/12); Month = Month + 1; Principal = Principal * (1+.03/12); Month = Month + 1; Principal = Principal * (1+.03/12); output; run; c. data savings; Month = 1; Principal = 250; format Principal comma10.2; Month = Month + 1; Principal = Principal * (1+.03/12); Month = Month + 1; Principal = Principal * (1+.03/12); Month = Month + 1; Principal = Principal * (1+.03/12); run; d. data savings; output; Month = 1; Principal = 250; format Principal comma10.2; output; Month = Month + 1; Principal = Principal * (1+.03/12); output; Month = Month + 1; Principal = Principal * (1+.03/12); output; Month = Month + 1; Principal = Principal * (1+.03/12); output; run;
Because there is no looping in these DATA steps, there must be one OUTPUT statement per observation to create the pictured data set. The correct answer is: data savings; Month = 1; Principal = 250; format Principal comma10.2; output; Month = Month + 1; Principal = Principal * (1+.03/12); output; Month = Month + 1; Principal = Principal * (1+.03/12); output; Month = Month + 1; Principal = Principal * (1+.03/12); output; run;
Which is a default behavior of PROC PRINT? Select one: a. display variables in alphabetical order b. display variable labels c. display observation numbers d. display only the top 10 observations of a data set
By default, PROC PRINT displays all variables and observations from a dataset. It does not display labels, and it does display row numbers. The correct answer is: display observation numbers
Which program sorts the data set sashelp.cars in descending order by Make? Select one: a.proc sort data=sashelp.cars desc; order Make; run; b.proc sort data=sashelp.cars; by descending Make; run; c.proc sort data=sashelp.cars order=desc; sortby Make; run; d.proc sort data=sashelp.cars; by Make descending; run;
By default, SAS sorts data in ascending order, from lowest to highest. To have your data sorted in the opposite order (which is what is called for in this question) you must add the keyword DESCENDING to the BY statement before each variable that should be sorted in the reverse order. The correct answer is: proc sort data=sashelp.cars; by descending Make; run;
Consider the following data step: data WORK.NEW; set WORK.OLD; Count+1; run; The varaible Count is created using a sum statement. Which statement regarding this variable is true? A. It is assigned a value 0 when the data step begins execution. B. It is assigned a value of missing when the data step begins execution. C. It is assigned a value 0 at compile time. D. It is assigned a value of missing at compile time.
C
Given the existing SAS program: proc format;value agegrplow-12 ='Pre-Teen'13-high = 'Teen'; run; proc means data=SASHELP.CLASS; var Height; class Sex Age; format Age agegrp.; run; Which statement in the proc means step needs to be modified or added to generate the following results: A. var Height / nobs min max mean maxdec=1; B. proc means data=SASHELP.CLASS maxdec=1 ; C. proc means data=SASHELP.CLASS min max mean maxdec=1; D. output nobs min max mean maxdec=1;
C
The SAS data set named WORK.SALARY contains 10 observations for each department,and is currently ordered by Department. The following SAS program is submitted: data WORK.TOTAL; set WORK.SALARY(keep=Department MonthlyWageRate); by Department; if First.Department=1 then Payroll=0; Payroll+(MonthlyWageRate*12); if Last.Department=1; run; Which statement is true? A. The by statement in the DATA step causes a syntax error. B. The statement Payroll+(MonthlyWageRate*12); in the data step causes a syntax error. C. The values of the variable Payroll represent the monthly total for each department in the WORK.SALARY data set. D. The values of the variable Payroll represent a monthly total for all values of WAGERATE in the WORK.SALARY data set.
C
The data set WORK.REALESTATE has the variable LocalFee with a format of 9. and a variable CountryFee with a format of 7.; The following SAS program is submitted: data WORK.FEE_STRUCTURE; format LocalFee CountryFee percent7.2; set WORK.REALESTAT; LocalFee=LocalFee/100; CountryFee=CountryFee/100; run; What are the formats of the variables LOCALFEE and COUNTRYFEE in the output dataset? A. LocalFee has format of 9. and CountryFee has a format of 7. B. LocalFee has format of 9. and CountryFee has a format of percent7.2 C. Both LocalFee and CountryFee have a format of percent7.2 D. The data step fails execution; there is no format for LocalFee.
C
The following SAS program is submitted once: ods HTML file = 'test.html'; proc print data = work.staff; proc freq data = work.staff; run; ods html close; A. only the freq procedure outpu B. only the print procedure output C. No procedure output due to syntax errors D. Both the PRINT procedure and FREQ procedure output
C
The following SAS program is submitted: data WORK.RETAIL; Cost='$20.000′; Discount=.10*Cost; run; What is the result? A. The value of the variable Discount in the output data set is 2000.No messages are written to the SAS log. B. The value of the variable Discount in the output data set is 2000.A note that conversion has taken place is written to the SAS log. C. The value of the variable Discount in the output data set is missing.A note in the SAS log refers to invalid numeric data. D. The variable Discount in the output data set is set to zero.No messages are written to the SAS log.
C
The following SAS program is submitted: data course; input exam; datalines; 50.1; run; proc format; value score 1 - 50 = 'Fail' 51 - 100 = 'Pass'; run; proc report data =course nowd; column exam; define exam / display format=score.; run; What is the value for exam? A. Fail B. Pass C. 50.1 D. No output
C
What caused the error in the "drop" statement of this code: data work.january; set work.allyear (keep=product month cost); if month='JAN' then output work.january; sales=cost*quantity; drop=month quantity cost; run; A. There should have been commas between the variable names. B. The list of variables should have been enclosed in parentheses. C. A drop statement and a keep= data set option cannot both be used at the same time. D. The syntax of the drop statement does not use an equals sign.
C
Which is a valid LIBNAME statement? A. libname "_SAS_data_library_location_"; B. sasdata libname "_SAS_data_library_location_"; C. libname sasdata "_SAS_data_library_location_"; D. libname sasdata sas "_SAS_data_library_location_";
C
Which of the following programs correctly invokes the DATA Step Debugger: A.data WORK.TEST debug; set WORK.PILOTS;State=scan(cityState,2,' '); if State='NE' then description='Central'; run; B.data WORK.TEST debugger;set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run; C.data WORK.TEST / debug; set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run; D.data WORK.TEST / debugger; set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run;
C
Which one of the following is true of the SUM statement in a SAS DATA step program? A. It is only valid in conjunction with a SUM function. B. It is not valid with the SET, MERGE and UPDATE statements. C. It adds the value of an expression to an accumulator variable and ignores missing values. D. It does not retain the accumulator variable value from one iteration of the SAS DATA step to the next.
C
Which one of the following statements is true regarding the name of a SAS array? A. It is saved with the data set. B. It can be used in procedures. C. It exists only for the duration of the DATA step. D. It can be the same as the name of a variable in the data set.
C
Which statement describes a characteristic of the SAS automatic variable _ERROR_? A. The _ERROR_ variable maintains a count of the number of data errors in a DATA step. B. The _ERROR_ variable is added to the program data vector and becomes part of the data set being created. C. The _ERROR_ variable can be used in expressions in the DATA step. D. The _ERROR_ variable contains the number of the observation that caused the data error.
C
Which statement specifies that records 1 through 10 are to be read from the raw data file customer.txt? A. infile 'customer.txt' 1-10; B. input 'customer.txt' stop@10; C. infile 'customer.txt' obs=10; D. input 'customer.txt' stop=10;
C
Which step displays a listing of all the data sets in the WORK library?A. proc contents lib=WORK run; B. proc contents lib=WORK.all;run; C. proc contents data=WORK._all_; run; D. proc contents data=WORK _ALL_; run;
C
How many of the following variable names will not produce errors in an assignment statement? variable var 1variable var1 #var _variable# A. 0 B. 1 C. 3 D. 6
C ; variable var var1. A variable cannot start with numeric or special characters except _. You also cannot use special characters anywhere in the name either though numeric values are allowed.
proc format; value salfmt. 0 -< 50000 = 'Less than 50K' 50000 - high = '50K or Greater'; options fmterr nodate pageno=1; title 'Employee Report'; proc print data=work.employees noobs; var fullname salary hiredate; format salary salfmt. hiredate date9.; label fullname='Name of Employee' salary='Annual Salary' hiredate='Date of Hire'; run; Why does the program fail? A. The PAGENO option is invalid in the OPTIONS statement. B. The RUN statement is missing after the FORMAT procedure. C. The format name contains a period in the VALUE statement. D. The LABEL option is missing from the PROC PRINT statement.
C When defining custom formats, the name of formats cannot end in a number or a period. The name, 'salfmt.', in VALUE statement is invalid. However, when you refer to the custom format, the ending period is necessary.
The following SAS program is submitted: data work.sets; do until (prod gt 6); prod + 1; end; run; Which one of the following is the value of the variable PROD in the output data set? A. 5 B. 6 C. 7 D. 8
C. Because of prod + 1 statement, SAS compiler will assume a retain prod 0; statement.First loop => prod = 1 => (1 gt 6) => false, loop continuesSecond loop => prod = 2 => (2 gt 6) => false, loop continues.....last loop => prod = 7 => (7 gt 6) => true, do until loop exits and pdv writes prod value of 7 to output dataset.
Q1. The following SAS program is submitted: data work.total; set work.salary(keep = department wagerate); by department; if first.department then payroll = 0; payroll + wagerate; if last.department; run; The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT. Which one of the following is true regarding the program above? A. The BY statement in the DATA step causes a syntax error. B. FIRST.DEPARTMENT & LAST.DEPARTMENT are variables in WORK.TOTAL dataset. C. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set. D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the WORK.SALARY data set.
C. For every BY group we get the sum of wagerate in the Payroll variable for each department.
The following SAS program is submitted: dta work.il_corn; set corn.state_data; if state = 'Illinois'; run; The keyword "data" is misspelled above. What happens to this program during the compilation phase assuming "corn" is a valid libref? A. The program fails due to syntax errors B. The DATA step compiles but doesn't execute C. The DATA step compiles and executes D. None of the above
C. It compiles and executes as SAS assumed that the 'dta' was data. But it leaves a warning in log window. The log shows the following warning : WARNING 1-322: Assuming the symbol DATA was misspelled as dta.141 run;
A raw data file is listed below:--------10-------20-------30 John McCloskey 35 71 June Rosesette 10 43 Tineke Jones 9 37 The following SAS program is submitted using the raw data file as input: data work.homework; infile 'file-specification'; input name $ age height; if age LE 10; run; How many observations will the WORK.HOMEWORK data set contain? A. 0 B. 2 C. 3 D. No data set is created as the program fails to execute due to errors.
C. The data set homework will have missing values under the age variable. The name has a blank in it so we need to use the & list modifier to read the data, also when using this we have to make sure that the data are at least two spaces apart.As SAS considers missing values smaller than 10 in age variable so it has included all the three observation in the data set.The corrected code is as follows: Data homewo; input fname$ lname $ age height; if age LE 10; datalines; John McCloskey 35 71 June Rosesette 10 43 Tineke Jones 9 37 ; run;
The following SAS program is submitted: libname sasdata 'SAS-data-library'; data test; set sasdata.chemists (keep = job_code); if job_code = 'chem3' then description = 'Senior Chemist'; run; The variable JOB_CODE is a character variable with a length of 6 bytes.Which one of the following is the length of the variable DESCRIPTION in the output data set? A. 6 bytes B. 8 bytes C. 14 bytes D. 200 bytes
C. The length of 'Senior Chemist' is 14.
The following SAS program is submitted: data work.report; set work.sales_info; if qtr(sales_date) ge 3; run; The SAS data set WORK.SALES_INFO has one observation for each month in the year 2000 and the variable SALES_DATE which contains a SAS date value for each of the twelve months.How many of the original twelve observations in WORK.SALES_INFO are written to the WORK.REPORT data set?
C. The qtr (quarter) values of each of the months (July through December) 7,8,9,10,11,12 is 3,3,3,4,4,4..Therefore 6 obs are included in the final dataset.
The following SAS program is submitted:proc sort data=work.employee;by descending fname;proc sort data=work.salary;by descending fname;data work.empdata;merge work.employee work.salary;by fname;run;Which one of the following statements explains why the program failed execution? A. The SORT procedures contain invalid syntax. B. The merged data sets are not permanent SAS data sets. C. The data sets were not merged in the order by which they were sorted. D. The RUN statements were omitted after each of the SORT procedures.
C. The two proc sorts are arranged in descending order. However, the merge is in ascending order. Hence, the two data sets won't be merged.In merge if you choose to sort by descending then you must use descending with merge statement otherwise it will not merge because of reason ( C ). It does not matter if you sort by ascending order.
Which one of the following is true of the RETAIN statement in a SAS DATA step program? A. It can be used to assign an initial value to _N_ . B. It is only valid in conjunction with a SUM function. C. It has no effect on variables read with the SET, MERGE and UPDATE statements. D. It adds the value of an expression to an accumulator variable and ignores missing values.
C.The RETAIN statement- is a compile-time only statement that creates variables if they do not already exist- initializes the retained variable to missing before the first execution of the DATA step if you do not supply an initial value- has no effect on variables that are read with SET, MERGE, or UPDATE statements.
Given the following raw data records: ----|----10---|----20Susan*12/29/1970*10Michael**6 The following output is desired: Which SAS program correctly reads in the raw data? A.data employees; infile 'file specification' dlm='*'; input employee $ bdate : mmddyy10. years; run; B.data employees; infile 'file specification' dsd='*'; input employee $ bdate mmddyy10. years; run; C.data employees; infile 'file specification' dlm dsd; input employee $ bdate mmddyy10. years; run; D.data employees; infile 'file specification' dlm='*' dsd; input employee $ bdate : mmddyy10. years; run;
D
How many of the following SAS data set names are valid? two_ _2test 2test 2-test A. 4 B. 3 C. 1 D. 2
D
The Excel workbook REGIONS.XLS contains the following four worksheets: EAST WEST NORTH SOUTH The following program is submitted: libname MYXLS 'regions.xls'; Which PROC PRINT step correctly displays the NORTH worksheet?A. proc print data=MYXLS.NORTH;run; B. proc print data=MYXLS.NORTH$;run; C. proc print data=MYXLS.'NORTH'e;run; D. proc print data=MYXLS.'NORTH$'n;run;
D
The following SAS program is submitted: data WORK.ACCOUNTING; set WORK.DEPARTMENT; length EmpId $6; CharEmpid=EmpId; run; If data set WORK.DEPARTMENT has a numeric variable EmpId. Which statement is true about the output dataset? A. The type of the variable CharEmpid is numeric. B. The type of the variable CharEmpid is unknown. C. The type of the variable CharEmpid is character. D. The program fails to execute due to errors.
D
The following SAS program is submitted: data revenue; var1 = mdy (1,15,1960); run; What is the value of the variable var1? A. '1/15/1960' B. 15 C. 1151960 D. 14
D
The following SAS program is submitted: data work.test; Title = 'A Tale of Two Cities, Charles J. Dickens'; Word = scan(title,3,','); run;
D
Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel? A. MSOFFICE2K B. EXCELXP C. CSVALL D. WINXP
D
Which statement is true concerning the SAS automatic variable _ERROR_? A. It cannot be used in an if/then condition. B. It cannot be used in an assignment statement. C. It can be put into a keep statement or keep= option. D. It is automatically dropped.
D
Which where statement would display observations wit Job_Title containing the word "Manager"? A. where upcase(scan(Job_Title,-1,' '))='MANAGER'; B. where Job_Title like 'Manager%'; C. where substr(Job_Title, (length(Job_Title)-6))='Manager'; D. where Job_Title='% Manager ';
D
ter a SAS program is submitted, the following is written to the SAS log: 101 data WORK.JANUARY;102 set WORK.ALLYEAR(keep=product month num_Sold Cost); 103 if Month='Jan' then output WORK.JANUARY; 104 Sales=Cost * Num_Sold; 105 keep=Product Sales; -----22ERROR 22-322: Syntax error, expecting one of the following: !,!!, &, *, **, +, -, , <=, <>, =, >, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL,NOTIN, OR, ^=, |, ||, ~=.106 run; What changes should be made to the KEEP statement to correct the errors in the LOG? A. keep=(Product Sales); B. keep Product, Sales; C. keep=Product, Sales; D. keep Product Sales;
D
Given the contents of the raw data file TYPECOLOR.DAT: —-+—-10—+—-20—+—-30daisyyellow The following SAS program is submitted: data FLOWERS; infile 'TYPECOLOR.DAT' truncover; length Type $ 5Color $ 11; input Type $Color $; run; What are the values of the variables Type and Color? A. Type=daisy, Color=yellow B. Type=daisy, Color=w C. Type=daisy, Color=daisyyellow D. Type=daisy, Color=
D The code neither specified where to read the value of each variable nor the delimiter. SAS will start to read value from left to right, using the default delimiter, space(' '). SAS reads the first value 'daisyyellow' and assigns it to variable 'Type'. As the length of 'Type' is 5 which means it can only hold up to 5 characters, the value is truncated to 'daisy'. Then SAS tries to read the second value for 'Color', but there is nothing left in the file. SAS simply sets the value to missing.
Which of the following is a valid statement about the VALUE range in the PROC FORMAT procedure? It cannot be... A. A single character or numeric value B. A range of character values C. A list of unique values separated by commas D. A combination of character and numeric values
D.
The SASDATA.BANKS data set has five observations when the following SAS program is submitted: libname sasdata 'SAS-data-library'; data allobs; set sasdata.banks; capital=0; do year = 2000 to 2020 by 5; capital + ((capital+2000) * rate); output; end; run; How many observations will the ALLOBS data set contain? A. 5 B. 15 C. 20 D. 25
D. Banks has 5 observations and then the do loop outputs for (20/5 + 1) times. Therefore 5*(20/5 + 1) = 25 is the observation count .
The following SAS program is submitted and reads 100 records from a raw data file: data work.total; infile 'file-specification' end = eof; input name $ salary; totsal + salary; run; Which one of the following IF statements writes the last observation to the output data set? A. if end = 0; B. if eof = 0; C. if end = 1; D. if eof = 1;
D. End is a sas keyword which will become true when SAS reads last record of a dataset. This value you cannot use directly in your program, so we create a alias name eof (end of file), but you can name it anything. EOF will carry the same value as internal variable END. So as we know 1=true and 0= false. if EOF = 1; will output only the last observation.
Suppose the variable 'Unit_Cost_Price' (numeric) contains both missing and non missing values. What would the following code return? proc sort data=ecsql1.price_list; by Unit_Cost_Price; run; A. A new dataset work.price_list is created with Unit_Cost_Price sorted in ascending order with missing values at the bottom of the dataset B. The dataset ecsql1.price_list is sorted with Unit_Cost_Price sorted in descending order with missing values at the bottom of the dataset C. A new dataset work.price_list is created with Unit_Cost_Price sorted in descending order with missing values at the top of the dataset D. The dataset ecsql1.price_list is sorted with Unit_Cost_Price sorted in ascending order with missing values at the top of the dataset
D. It is because missing values are considered as lowest values (ascending order; they will be top of the data set)
The following SAS program is submitted:data work.products; Product_Number = 5461; Item = '1001'; Item_Reference = Item'/'Product_Number; run; Which one of the following is the value of the variable ITEM_REFERENCE in the output data set? A. 1001/5461 B. 1001/ 5461 C. . (missing numeric value) D. The value can not be determined as the program fails to execute due to errors.
D. Since there is no concatenate symbol between Item and Product_Number.
The following SAS DATA step is submitted:data sasdata.atlanta sasdata.boston work.portland work.phoenix;set company.prdsales;if region = 'NE' then output boston;if region = 'SE' then output atlanta;if region = 'SW' then output phoenix;if region = 'NW' then output portland;run; Which one of the following is true regarding the output data sets? A. No library references are required. B. The data sets listed on all the IF statements require a library reference. C. The data sets listed in the last two IF statements require a library reference. D. The data sets listed in the first two IF statements require a library reference.
D. The datasets in the first two IF statements require "sasdata" libref.
Which assignment statement creates a character variable? Select one: a.anniversary = "18apr2022"d; b.anniversary = "18APR22"d; c.anniversary = "18apr2022";Correct d.anniversary = 18Apr22;
Date constants are numerics, and "18Apr22" would cause an error. A value in quotation marks (and without a trailing d, t, or dt) is a character value. The correct answer is:anniversary = "18apr2022";
Which DATA statement is needed to complete this program? insert-statement-hereset sashelp.cars; if type="Sedan" or type="Wagon" then output cars; else if type="Truck" or type="SUV" then output trucks; run; Select one: a.data; b.data Sedan Wagon Truck SUV; c.data cars trucks; d.data sedan wagon truck suv;
Here, in a DATA step, you must first specify the name of the new SAS data set in the DATA statement. On the conditional statements, the use of output cars and output trucks is the reason the statement data cars trucks; is correct. The correct answer is: data cars trucks;
Which sentence is true regarding a DATA step with the MERGE and BY statements? Select one: a. The variable on the BY statement must exist in one data set. b. The data sets must be sorted by the variable on the BY statement. Correct c. The MERGE statement can combine only two data sets. d. The DATA step with the MERGE statement combines data vertically.
If the data sets are NOT sorted by the variable on the BY statement, the program will fail. The DATA step with the MERGE statement combines data horizontally. The MERGE statement can combine two or more data sets. The variable on the BY statement must exist in all data sets. The correct answer is: The data sets must be sorted by the variable on the BY statement.
Which statement correctly returns matching observations when the two data sets are merged? data patienthistory; merge patient(in=inP) appointment(in=inA); by PatientID; insert-statement-here; run; Select one: a.if inP=1 and inA=0; b.if inP=1 and inA=1;Correct c.if inP=1; d.if inP=1 or inA=1;
If the returned observation is in both patient and appointment, then the value for the data set contributor options (inP and inA) will both equal 1. The correct answer is:if inP=1 and inA=1;
Which statement is true with regard to character variables? Select one: a. The byte size limit is 32. Incorrect b. A character value must contain a letter. c. One character represents one byte. d. Values are stored using floating-point representation.
In SAS, one character equals one byte. Character values can have letters, numbers, and/or underscores is true for character names. For values, you can have anything: letters, numbers, and any special character such as the space or underscore. The byte size limit is 32,767. Only numeric values are stored using floating point representation. The correct answer is: One character represents one byte.
Which program correctly sends the PROC PRINT results to an RTF file named shoes? Select one: a.ods rtf file='C:\shoes.rtf';proc print data=sashelp.shoes;run;ods rtf close; b.ods rtf 'C:\shoes.rtf'; proc print data=sashelp.shoes; run; ods rtf close; c.ods rtf out='C:\shoes.rtf'; proc print data=sashelp.shoes; run; ods rtf close;Incorrect d.ods file='C:\shoes.rtf'; proc print data=sashelp.shoes; run; ods close;
In order to send the PROC PRINT results to an RTF file, you must use the ODS statement that specifies the destination and the FILE= option to specify the name of the file in quotation marks. You then need to use the ODS RTF CLOSE statement to specify that you want to stop writing to the RTF file. The correct answer is: ods rtf file='C:\shoes.rtf';proc print data=sashelp.shoes;run;ods rtf close;
Which PROC FORMAT step produces an error? Select one: a.proc format;value grade 1='A' 2='B'3='C';run; b.proc format;value codes 1-3='low' 4-6='medium' 7-9='high';run; c.proc format;value mult 0,1,5='No' 2='Yes' 6-8='Unsure';run; d.proc format; value 1,3,5='odds'2,4,6='evens';run;
In the VALUE statement, after the keyword VALUE, you must specify the name of the format before specifying the values to format. The correct answer is: proc format; value 1,3,5='odds' 2,4,6='evens'; run;
Which SET statement has valid syntax for reading the temporary data set new? Select one: a.set data=new; b.set=new; c.set data new; d.set new;
List the name of the temporary data set on the SET statement and end the statement with a semicolon. The correct answer is:set new;
Which DATA statement correctly creates three SAS data sets? Select one: a.data one, two, three; b.data=one data=two data=three; c.data=one two three; d.data one two three;
List the names of the multiple data sets you want to create on the DATA statement separated by a space and end the statement with a semicolon. The correct answer is:data one two three;
What are two ways to check if the character variable Name has a missing value? (Choose two.) Select one or more: a.where Name = " "; b.where Name = '.'; c.where Name is missing; d.where Name = missing;
Missing character values are represented with a blank. The IS MISSING operator checks for the existence of either character or numeric values depending the data type of the variable used in the statement. To explicitly check for missing character, you can use " ", for example where Name = " "; The correct answers are:where Name is missing;,where Name = " ";
Given the report and PROC FREQ step shown, which code completes the TABLES statement? The FREQ procedure Product Frequency CumulativeFrequency Boot 52 52 Men's Casual 45 97 Men's Dress50 147 Sandal 49 196 Slipper 52 248 Sport Shoe 51 299 Women's Casual 45 344 Women's Dress 51 395 proc freq data=sashelp.shoes;tables product / insert-option(s)-here;run; Select one: a. NOFREQ b. NOPERCENT c. NOCUM NOFREQ d. NOCUM NOPERCENT
NOPERCENT suppresses the percent and cumulative percent statistics. The correct answer is: NOPERCENT
Given the input data set sales shown below: Location Quantity Austin 15 Dallas 25 Houston 5 Amarillo . The following code is submitted: data accumulate; set sales; insert-statement-here run; Which statement correctly creates an accumulating column for total Quantity? Select one: a.Total = sum(Total, Quantity); b.Total + Quantity; c.Total = Total + Quantity; d.if Quantity ^= . then Total = sum(Total, Quantity);
Only the SUM statement retains values from row to row, without a separate RETAIN statement. The correct answer is:Total + Quantity;
Which statement is true concerning the PROC CONTENTS step? Select one: a. PROC CONTENTS displays the global options that have been assigned. b. PROC CONTENTS creates a report of the SAS products that are installed on the given computer. c. PROC CONTENTS shows a listing of the SAS programs that are available in the default location. d. PROC CONTENTS creates a report of the descriptor portion of a SAS data set.
PROC CONTENTS creates a report of the descriptor portion of a SAS data set. PROC SETINIT creates a report of the SAS products installed on the given computer and PROC OPTIONS displays the global options that have been assisgned. The correct answer is: PROC CONTENTS creates a report of the descriptor portion of a SAS data set.
Given the SAS program shown below, after running the program, which statement is true? data Setosa Versicolor; set sashelp.iris; if Species = "Setosa" then output Setosa; run; Select one: a. sashelp.iris will only contain rows where Species is Setosa. b. Versicolor will contain no rows. Correct c. Versicolor will contain all rows where Species is not Setosa. d. No data set is created. There is an error in the log.
Rows are explicitly output to Setosa. No rows are explicitly output to Versicolor. The correct answer is: Versicolor will contain no rows.
Given the DATA step shown below, what is the length of the variable Country? data BballCountry; set sashelp.baseball ; if League='American' then Country='US'; else if League='National' then Country='Other'; length Country $ 6; run; Select one: a. 2 b. 6 c. 3 d. 5
SAS determines the length of character variables from its first occurrence in the DATA step. Using the LENGTH statement after the variable's first occurrence in the DATA step does not change the length. To avoid truncation, use the LENGTH statement before the first occurrence of the character variable. 2 is the byte size because the first place SAS sees Country is the first IF/THEN, which has Country='US'. Therefore, the byte size is 2 because of US. The correct answer is: 2
The following program is submitted: data work.sum; first = 5; second = .; third = 10; fourth = first + second + third; run; What is the value of fourth in the data set work.sum? Select one: a. . b. 5 + . + 10 c. 15 Incorrect d. first + second + third
SAS sets the results of a calculation to missing if a missing value is used in an arithmetic expression. The correct answer is: .
The following SAS program is submitted: data work.accounting; set work.dept1 work.dept2; run; A character variable named JOBCODE exists in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set. Which one of the following is the length of the variable JOBCODE in the output data set? A. 5 B. 7 C. 8 D. 12
Since SAS checks the variable Job_code in DEPT1 for the first time of length of 5 Bytes. it sets the length to be 5. All the values that are read from DEPT2 are truncated to Chars.
Given the following step, which subsetting statement can be added to the PROC MEANS step to subset for values of 1B, 2B, or 3B? proc means data=sashelp.baseball; class position; var nRuns nRBI; run; Select one: a.if position in ('1B','2B','3B'); b.where position='1B' or '2B' or '3B';Incorrect c.where position in ('1B' '2B' '3B'); d.if position='1B' or '2B' or '3B';
Subsetting IF statements can only appear in DATA steps, therefore the two options with IF statements are not correct. In SAS, WHERE statements can be used in both DATA and PROC steps. The syntax for the IN operator is appropriate for subsetting for a list of values. The = operator would be appropriate if position = was specified in front of each value such as position = '1B', position ='2B', position ='3B'. The correct answer is: where position in ('1B' '2B' '3B');
Given the following output, which statement creates the variable FirstLast? First Last FirstLast Jane Smith Jane Smith Todd Brown Todd Brown a. FirstLast=catx(First, ,Last); b. FirstLast=catx( ,First,Last); c. FirstLast=catx(First,' ',Last); d. FirstLast=catx(' ',First,Last)
The CATX function requires the delimiter to be specified first, followed by the variables you wish to concatenate. The correct answer is: FirstLast=catx(' ',First,Last);
Given the following program, which statement will correctly subset the data to include only the observations that have error within the Text variable? data birds; set sashelp.bird; insert-statement-here; run; Select one: a.where Text contains 'error'; b.where Text like 'error'; c.where Text = 'error';Incorrect d.where find 'error' in Text;
The CONTAINS operator tests whether a string is part of the variable's values. The correct answer is:where Text contains 'error';
Which step permanently adds labels and formats to a data set? Select one: a. PROC PRINT step b. DATA step c. PROC FORMAT step Incorrect d. PROC LABELS step
The DATA step creates data and any attributes assigned by the LABEL and FORMAT statements in the DATA step are permanently stored with the data set. The correct answer is: DATA step
The following SAS program is submitted: proc sort data=SASUSER.PROJECTS out=PSORT; by Product Code descending Date Cost; run; Which of the following is true concerning the submitted program? Select one: a. The DESCENDING option applies only to the Date variable. b. The DESCENDING option applies only to the Code variable. c. The DESCENDING option applies to the Product and Code variables. d. The DESCENDING option applies to the Date and Cost variables.
The DESCENDING option must proceed the variable you wish to be in the descending order. The correct answer is: The DESCENDING option applies only to the Date variable.
The following PROC PRINT step is submitted. proc print data=work.expenses; run; The following report is created: Obs Name Date Amount 1 Jill 21735 1134.22 2 Tony 21741 7500.00 3 Fred 21745 10765.95 The following report is desired: Obs Name Date Amount 1 Jill 05JUL2019 1,134 2 Tony 11JUL2019 7,500 3 Fred 15JUL2019 10,766 Which FORMAT statement can be added to the PROC PRINT step to produce the desired report? Select one: a.format Date=date9. Amount=comma8.; b.format Date date9. Amount comma8.; c.format Date date9 Amount comma8; d.format Date(date9) Amount(comma8);
The FORMAT statement format Date date9. Amount comma8.; associates the DATE9. numeric format with the variable Date and displays the date as 05JUL2019. It also associates the COMMA8. format with the variable Amount, displaying the values with commas. The correct answer is:format Date date9. Amount comma8.;
You submit a program and the SAS log is shown below: 34 proc print data=sashelp.cars; 35 var make model msrp mpg_city 36 mpg_highway horsepower weight 37 format weight comma8.; _______22201ERROR: Variable FORMAT not found. ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 201-322: The option is not recognized and will be ignored.38 run; Which statement contains the error? Select one: a. PROC PRINT b. FORMAT c. RUN d. VAR
The FORMAT statement is underlined, but the error is a missing semicolon in the VAR statement. The correct answer is: VAR
When using IF/THEN conditional logic in a DATA step, how many executable statements are permitted after the THEN? Enter your numeric answer in the space. Answer: 1
The IF/THEN conditional logic statement in a DATA step permits one executable statement after the THEN. If you have more than one executable statement, use the DO group with the IF/THEN statement. The correct answer is: 1
The Customer data set shown below has five variables: CustomerID Name Phone Age LoyaltyGroup 1 Sara 410-555-4040 18 Gold 2 Colton 919-555-3489 29 Silver 3 Heidi 201-555-1770 45 Bronze 4 Brian 212-555-6780 33 Gold The following DATA step is written: data A(keep=CustomerID Age); set Customer(drop=Name Phone); run; How many variables will be in the new data set? Select one: a. 3 b. 1 c. 2 Correct d. 5
The KEEP= data set option on the DATA statement lists two variables. These are the two variables that will be in the new data set. The DROP= data set option on the SET statement excludes the two variables listed from being processed when the INPUT data set is read, and the remaining three variables are processed. The correct answer is: 2
Which statement is considered a compile-time only statement? Select one: a. SET statement b. LENGTH statement c. IF statement d. DO statement
The LENGTH statement specifies the number of bytes for storing character and numeric variables at compilation of the step and is not an executable statement. The correct answer is: LENGTH statement
Which statement is true regarding the LIBNAME statement for reading SAS data sets? Select one: a. A library reference on the LIBNAME statement specifies a shortcut name for the storage location of SAS data sets. b. SAS9 is the default engine if an engine is NOT specified on the LIBNAME statement. c. The LIBNAME statement belongs in the DATA step after the DATA statement. d. A LIBNAME statement specifies a library reference, an engine, a storage location, and a data set name
The LIBNAME statement specifies a shortcut name for the storage location of SAS data sets, also known as a library reference. This statement is a global statement that can stand-alone in the program. V9 is the default engine if an engine is not specified. The correct answer is: A library reference on the LIBNAME statement specifies a shortcut name for the storage location of SAS data sets.
Which PROC MEANS option controls the number of decimal places displayed in the report? Select one: a. NODEC b. MAXDEC= c. DECIMALS= d. MEANDEC
The MAXDEC= option is one of the options that controls how your data are summarized. It is the only option that specifies the number of decimal places to be displayed. The correct answer is: MAXDEC=
The BirthDate variable is equal to a value of 9205, which corresponds to the date of Friday, March 15, 1985. Given the following statement, what is the value of BirthMnth? BirthMnth=month(BirthDate); Select one: a. 03 b. MAR c. March d. 3
The MONTH function extracts the numeric month value from the specified date value. The MONTH function returns only the integer 1-12 without a leading zero. The correct answer is: 3
Which PROC PRINT option suppresses the display of the observation number in the report? Select one: a. NOPRINT b. NOOBS c. NONUM d. NOROW
The NOOBS option suppresses the display of the observation number in the PROC PRINT report. The correct answer is: NOOBS
Which PROC FREQ step displays the data in the report by descending frequency? Select one: a.proc freq data=sashelp.cars order=freq; tables type; run; b.proc freq data=sashelp.cars;tables type / order=freq;run; c.proc freq data=sashelp.cars;tables type order=freq;run; d.proc freq data=sashelp.cars / order=freq;tables type;run;
The ORDER=FREQ option must be specified in the PROC FREQ statement itself in order to create a report by descending frequency. The correct answer is:proc freq data=sashelp.cars order=freq;tables type;run;
Which PROC SORT program sorts the sashelp.class data in order by Age and then Name and writes the sorted data to the data set sortclass? Select one: a.proc sort data=sashelp.class data=sortclass;by Age Name;run; b.proc sort data=sashelp.class;by Name Age;output sortclass;run; c.proc sort data=sashelp.class out=sortclass;by Age Name;run; d.proc sort data=sashelp.class;by Name Age;output out=sortclass;run;
The OUT= option specifies the name of the sorted data set you want to create. The BY statement specifies the sort variables in the order listed. The correct answer is: proc sort data=sashelp.class out=sortclass; by Age Name; run;
Which statement about PROC SORT is true? Select one: a. PROC SORT will display the sorted data in a report. b. PROC SORT overwrites the original data set by default. c. PROC SORT sorts the data in descending order by default. d. PROC SORT can sort the data by only one variable.
The PROC SORT step overwrites the original data set by default, sorts the data in ascending order by default, and can sort the data by one or more variables. The correct answer is: PROC SORT overwrites the original data set by default.
Which statement aids in debugging logic errors? Select one: a. TRACELOG b. _ERROR_ c. PUTLOG Correct d. DEBUG
The PUTLOG statement writes messages that you specify to the SAS log and can be helpful when debugging logic errors. The automatic variable _ERROR_ is 0 by default but is set to 1 when a data error occurs. The correct answer is: PUTLOG
Which statement reads the temporary data set October? Select one: a.set October;Correct b.in October; c.data October; d.read October;
The SET statement reads in data sets. The correct answer is:set October;
Which statement is true regarding the FREQ procedure? Select one: a. The TABLES statement specifies the variables that are analyzed in the FREQ procedure. b. By default, the FREQ procedure creates a frequency table for each character variable in the input data set. c. The FREQ procedure can produce only a one-way frequency table. d. The ORDER=FREQ option sorts the input data set in the FREQ procedure.
The TABLES statement specifies the variables that are analyzed in the FREQ procedure. By default, a PROC FREQ step without a TABLES statement creates a frequency table for each character and numeric variable in the input data set. You can produce one-way or n-way tables and the ORDER=FREQ option produces a report with descending frequency counts. The correct answer is: The TABLES statement specifies the variables that are analyzed in the FREQ procedure.
Which statement is true concerning the TITLE statement? Select one: a. The TITLE statement must be in a PROC step. b. A report can only use one TITLE statement. c. The TITLE statement is a global statement. d. title=clear; clears out all previously defined titles.
The TITLE statement is a global statement that can be used outside or inside of a PROC step. A report can have from 1 to 10 titles and a null TITLE statement (TITLE;) clears all previously defined titles. The correct answer is: The TITLE statement is a global statement.
Given the code shown below, which two statements are true? (Choose two.) data work.homeruns23; set sashelp.baseball; /* where nhome=23; */run; Select one or more: a. WORK.HOMERUNS23 contains only the rows where NHOME is equal to 23. Incorrect b. WORK.HOMERUNS23 contains the same number of rows as SASHELP.BASEBALL. c. The WHERE statement is ignored. Correct d. The WHERE statement is executed.
The WHERE statement is ignored because it is commented. Commented statements are not executed. Because the WHERE statement is not executed, all the rows are read from SASHELP.BASEBALL. The correct answers are: The WHERE statement is ignored., WORK.HOMERUNS23 contains the same number of rows as SASHELP.BASEBALL.
Which two sentences are true regarding the assignment statement? (Choose two.) Select one or more: a. Character and numeric variables can be created. b. Formats can be assigned to a variable. Incorrect c. A variable can be dropped from a data set. Incorrect d. The value of a variable can be updated.
The assignment statement is used to create a numeric or character variable. If the variable does not exist in the input data set, the assignment statement creates a new variable. If variable already exist in the input data set, the assignment statement updates the variable's value. The correct answers are: Character and numeric variables can be created., The value of a variable can be updated.
Which two LIBNAME statements create a library reference for accessing SAS data sets? (Choose two.) Select one or more: a.libname test base "C:\User\Maria\Data"; b.libname "C:\User\Maria\Data" test; c.libname test = "C:\User\Maria\Data"; d.libname test "C:\User\Maria\Data";
The base library is implied, and it may be explicitly specified. The correct answers are:libname test "C:\User\Maria\Data";,libname test base "C:\User\Maria\Data";
Which PROC MEANS program generates the following report? The Means Procedure Variable Label N Mean Std Dev Minimum Maximum SepalLength Sepal Length (mm) 10462.66.254.079.0 S epalWidth Sepal Width (mm) 10429.64.222.044.0 PetalLength Petal Length (mm)10446.512.712.069.0 PetalWidth Petal Width (mm)10415.75.82.025.0 Select one: a.proc means data=sashelp.iris maxdec=1; var petalWidth; run; b.proc means data=sashelp.iris maxdec=1; class Species; run; c.proc means data=sashelp.iris maxdec=1; by Species; run; d.proc means data=sashelp.iris maxdec=1; where SepalLength > 53; run;
The default of the MEANS procedure is to generate statistics for all numeric variables in the data set if no VAR statement is applied in the step. The correct answer is:proc means data=sashelp.iris maxdec=1; where SepalLength > 53; run;
Given the following DATA step, how many observations are in the output data set work.savings? data work.savings; amount=5000; do year=1 to 5; do month=1 to 12; amount+(amount*0.03/12); end; output; end; run; Enter your numeric answer in the space below.
The explicit OUTPUT statement is outside of the inner DO loop. The step outputs one observation per each iteration of the outer DO loop up to YEAR=5, when YEAR passes the value of 5, execution of the DO loop stops. The correct answer is: 5
Which action occurs first in the execution phase of the DATA step? Select one: a. Calculations in the program are executed. b. The observation in the PDV is written to the output data set. c. An observation from the input data set is read into the PDV. d. The PDV is initialized.
The first action in the execution phase of the DATA step is initializing the PDV, then the observations are read into the PDV, calculations in the program are executed and finally the observations in the PDV is written to the output data set. The correct answer is: The PDV is initialized.
The data set HeadofState1900 has the variable Country with a length of 20 and the variable Title with a length of 30. The following SAS program is submitted: data HeadOfState1900_cleaned; length Country $ 15; set HeadofState1900; Country = propcase(Country); Title = upcase(Title); Date = mdy(1,1,1900); format Date date9.; run; What are the lengths of the variables Country and Title in the output data set? Select one: a. Country has a length of 15, and Title has a length of 30. b. Country has a length of 15, and Title has a length of 8. c. Country has a length of 20, and Title has a length of 30. d. Country has a length of 8, and Title has a length of 8.
The first time Country is referenced in the DATA step, it has a length of 15. The first time Title is referenced (through the SET statement), it has a length of 30. The correct answer is: Country has a length of 15, and Title has a length of 30.
Review the data sets sales_region1 and sales_region2 and the DATA step below. sales_region1 Obs ProductID Quantity Location 1 0635 34 Greensboro 2 0385 12 High Point sales_region2 Obs ProdID quantity location 1 0689 25 Austin 2 0143 48 Dallas data sales; set sales_region1 sales_region2; if quantity >= 0; run; How many columns will be in the data set sales?Enter your numeric answer below. Answer:
The four columns in sales will be ProductID, Quantity, Location, and ProdID. The correct answer is: 4
Which PROC EXPORT step correctly creates the storms.csv file from the mydata.storms data set? Select one: a.proc export data=storms.csv outfile=mydata.storms; dbms=csv;run; b.proc export data=mydata.storms outfile="storms.csv" dbms=csv;run; c.proc export data=mydata.storms outfile="storms.csv"; dbms=csv;run; d.proc export data=mydata.storms outfile=storms.csv dbms=csv;run;
The general form for PROC EXPORT statement is: PROC EXPORT DATA = data-set OUTFILE = 'filename' options; The OUTFILE= option specifies the filename and extension in a set of quotes. You can specify the file type by adding the DBMS= option to the PROC EXPORT statement. The DBMS= option is not a standalone statement. The correct answer is: proc export data=mydata.storms outfile="storms.csv" dbms=csv;run;
Complete the statement such that the variable Mass is renamed to MassMetric when reading the Experiment data set. set experiment(insert-option-here); Select one: a.rename Mass=MassMetric b.rename (Mass,MassMetric) c.rename=(Mass=MassMetric)Correct d.rename Mass as MassMetric
The old name, Mass, goes before the equals sign. The new name, MassMetric, goes after the equals sign. rename=(Mass=MassMetric) The correct answer is:rename=(Mass=MassMetric)
Review the data sets sales_region1 and sales_region2 and the DATA step below. sales_region1 Obs ProductID Quantity Location 1 0635 34 Greensboro 2 0385 12 High Point sales_region2 Obs ProdID quantity location 1 0689 25 Austin 2 0143 48 Dallas data sales; set sales_region1(drop=Location) sales_region2; keep Quantity; run; Including _ERROR_ and _N_, how many variables are in the program data vector? Select one: a. 8 b. 6 Correct c. 5 d. 3
The program data vector will contain ProductID, Quantity, ProdID, location, _ERROR_, and _N_. The correct answer is: 6
A SAS date is the number of days since January 1, 1960 and the specific date. The starting point of January 1, 1960 is represented as ___ on a number line.Enter your numeric answer for the space above.
The starting point of January 1, 1960 is represented as 0 on a number line. SAS dates represent the number of days since January 1, 1960. The correct answer is: 0
Given the following program, which statement subsets only the observations where the value of Discount is greater than 5,000? data discount; set sashelp.cars;Discount=MSRP*.10; insert-statement-here; run; Select one: a.where Discount > 5000;Incorrect b.if Discount > 5000; c.where Discount gt 5,000; d.if Discount gt 5,000;
The subsetting IF statement subsets only those observations that meet the condition. The condition can include variables from the existing input data set or newly created variables in the step. When subsetting for numeric variables, numeric variables can include the digits 0 through 9 plus positive, negative, and E-notation. The WHERE statement is a preproccessor; you can use only variables from the existing input data set, not newly created variables in the step. The correct answer is:if Discount > 5000;
Given the following DATA step, what is the final value of the variable i in the output data set work.mydata? data work.mydata; do i=0 to 10 by 2; equation=i/2; end; run; Select one: a. 12 b. 11 c. 10 d. .
The value of the index variable i is 12 in the output data set work.mydata. The value of the index variable is incremented at the bottom of the DO loop, when i=10, i gets incremented by 2, i=12 passes the value of the STOP value of 10, so when the step returns to the top of the loop, i is no longer within range of the STOP value and the DO loop stop execution. After the DO loop stops, the implied OUTPUT is executed, so the value of 12 is written to the output data set. The correct answer is: 12
How many steps are in the program shown below? proc print data=sashelp.cars; var make model msrp mpg_city mpg_highway horsepower weight; format weight comma8.; run; Select one: a. 1 b. 3 c. 4 Incorrect d. 5
There is one PROC PRINT step in this program. There are four statements, and five lines of code. The correct answer is: 1
Which is a valid variable or data set name? Select one: a. $1EMPLOYEE_NAME b. _1EMPLOYEE_NAME c. _1EMPLOYEE NAME d. 1EMPLOYEE_NAME
Valid variable or data set names must begin with a letter or an underscore(_) and can continue with letters, numbers and underscores up to 32 characters. The correct answer is: _1EMPLOYEE_NAME
Given the input data set sales, Month Sales 1 5 1 5 1 5 2 5 2 5 2 5 3 10 3 10 3 10 The following code is submitted: data Total; set sales; by month; if first.month=1 then TotalSales=0; TotalSales + Sales; insert-statement-here run; The data set Total is shown below: Month Sales TotalSales 1 5 5 1 5 10 1 5 15 2 5 5 2 5 10 2 5 15 3 10 10 3 10 20 3 10 30 Which subsetting IF statement correctly selects the final row of each month to produce the data below? Month Sales TotalSales 1 515251531030 Select one: a.if last.month=0; b.if month=1; c.if last.month=1; d.if last=1;
When SAS reads the last occurrence of each month, the value of last.month is equal to 1. The subsetting IF controls which observations are processed and written to the new SAS data set The correct answer is:if last.month=1;