A00-212 - SAS Advanced Programming for SAS 9

Go back to SAS-Institute

Example Questions

Which one of the following is true regarding the KEEP statement? The following SAS program is submitted: data temp; set sasuser.history(kep=date); format date qtr <insert BY statement here> if first.date then total=0; total+1; if last.date; run; proc print data=temp; run SASUSER.HISTORY is sorted by the SAS date variable DATE. The following output is required: Date Total 1 13 3 15 4 25 Which By statement completes the data step and successfully generates the required output? Given the following SAS data set ONE: ONE COUNTRY CITY VISIT USA BOSTON 10 UK LONDON 5 USA DALLAS 10 UK MARLOW 10 USA BOSTON 20 UK LONDON 15 USA DALLAS 10 The following SAS program is submitted: proc sql; select country, city, sum(visit) as TOTAL from one group by country, city order by country, total desc; quit; Which one of the following reports is generated? The following SAS program is submitted: data new; do i=1,2,3 nextfile=compress('March' || |); infile abc filevar=nextfile end=eof; do until (eof); input dept $sales; end; run; What is the purpose of the FILEVAR=option on the INFILE statement? Which one of the following statements is true? Given the following partial SAS log: NOTE: SQL table SASHELP.CLASS was created line Create table SASHELP.CLASS(bufsize=4096) ( Name char(8); Gender Char(1); Age num; Height num; Weight num ); Which SQL procedure statement generated this output? Which one of the following options controls the pagesize of a SAS data set? Which one of the following statements is true regarding a SAS DATA step view? What is generated as a result of submitting the RANUNI function with a seed of 123? What is the purpose of the SASFILE statement? Given the following SAS data sets ONE and TWO: ONE TWO NUM CHAR1 NUM CHAR2 1 A1 2 X1 1 A2 2 X2 2 B1 3 Y 2 B2 5 V 4 D The following SAS program is submitted creating the output table THREE: proc sql; create table three as select one.num, char1, char2 from one, two where one.num = two.num; quit; THREE NUM CHAR1 CHAR2 2 B1 X1 2 B1 X2 2 B2 X1 2 B2 X2 Which one of the following DATA step programs creates an equivalent SAS data set THREE? Which SET statement option names a variable that contains the number of the observation to read during the current iteration of the DATA step? Given the following SAS data sets ONE and TWO: ONE TWO YEAR QTR BUDGET YEAR QTR SALES 2001 3 500 2001 4 300 2001 4 400 2002 1 600 2002 1 700 The following SAS program is submitted: proc sql; select one.*, sales from one, two; quit; Which one of the following reports is generated? The following SAS program is submitted: data temp; length 1 b 3 x; infile 'file reference'; input a b x; run; What is the result? The following SAS program is submitted: %let a =cat; %macro animal(a=frog); %let a = bird; %mend; %animal(a=ping); %put a is &a; What is written to the SAS log? Which one of the following SAS programs uses the most amount of memory resources for output buffers? Given the non-indexed SAS data set TEMP: TEMP X Y P 52 P 45 A 13 A 56 R 34 R 12 R 78 The following SAS program is submitted: Proc print data=temp; <insert By statement here? Run; Which by statement completes the program, create a listing report that is grouped by X and completes without errors? The following SAS program is submitted: %micro test(var); %let jobs=BLACKSMITH WORDSMITH SWORDSMITH; %let type=%index(&jobs,&var); %put type = &type; %mend; %test(SMITH) What is the value of the macro variable TYPE when the %PUT statement executes? Which one of the following SAS procedures changes a permanent format of a variable stored in a SAS data set? At the start of a new SAS session; the following program is submitted: %macro one; data _null_; call symput('proc','measn); run; proc &proc data=sashelp.class; run; %mend; %one() What is the result? Given the following SAS data set ONE: ONE CATEGORY AGE SALARY BONUS ---- M 28 200 . M 25 100 10 F 18 100 50 F 25 200 10 The following SAS program is submitted: proc sql; create table two as select category, salary + bonus as EARNINGS from one; quit; Which one of the following represents the data values stored in the data set TWO? Assume today is Tuesday, July 23, 2002. Which one of the following statements submitted at the beginning of a SAS session assigns the value Tuesday, July 23, 2002 to the macro variable START? At the start of a new SAS session; the following program is submitted: %macro one; data _null_; call symput('proc','measn); run; proc &proc data=sashelp.class; run; %mend; %one() What is the result? What is an advantage of using a hash object in a SAS DATA step? Given the SAS data set ONE: ONE DIVISION SALES A 1234 A 3654 B 5678 The following SAS program is submitted: Data_null_; Set one; By divition; If first.division then Do; %let mfirst=sales; end; run; What is the value of the macro variable MFRIST when the program finishes execution? The following SAS program is submitted: %macro one(input); %two; %put the value is &date; %mend; %macro two; data _null_; call symput('date','12SEP2008'); run; %mend; %let date=31DEC2006; %one(&date) What is the result when the %PUT statement executes? The following SAS program is submitted: %macro location; data _null_; call symput ('dept','sales'); run; %let country=Germany; %put_global_; %mend; %let company = ABC; %location; Which macro variables are written to the SAS log? The following SAS program is submitted: options yearcutoff = 1950; %macro y2kopt(date); %if &date >= 14610 %then %do; options yearcutoff = 2000; %end; %else %do; options yearcutoff = 1900; %end; %mend; data _null_ ; date = "01jan2000"d; call symput("date",left(date)); run; %y2kopt(&date) The SAS date for January 1, 2000 is 14610 and the SAS system option for YEARCUTOFF is set to 1920 prior to submitting the above program. Which one of the following is the value of YEARCUTOFF when the macro finishes execution? Given the SAS dataset ONE: ONE SALARY The following SAS program is submitted: Proc sql; Select * from one <insert WHERE expression here>; Quit; The following output is desired: SALARY Which WHERE expression completes the program and generates the desired output? Which SAS procedure changes the name of a permanent format for a variable stored in a SAS data set? Which one of the following should be avoided when creating and using an SQL procedure view? Which of the following statement(s) in the DATASETS procedure alters the name of a SAS data set stored in a SAS data library? The following SAS program is submitted. filename sales ('external-file1' 'external-file2'); data new; infile sales; input date date9. company $ revenue; run; Which one of the following is the result of including the FILENAME statement in this program? The following SAS program is submitted: %macro check(num=4); %let result=%sysevalf(&num+0.5); %put result is &result; %mend; %check(num=10) What is the written to the SAS log? The following SAS program is submitted: proc datasets lib = testdata; modify one; label num = 'Number'; format num 4.; quit; Which one of the following SQL programs produces the same results as the above DATASETS procedure? Which one of the following is an advantage of creating and using a SAS DATA step view? The following SAS program is submitted: data one; do i = 1 to 10; ptobs = ceil(ranuni(0) * totobs); set temp point = ptobs nobs = totobs; output; end; stop; run; The SAS data set TEMP contains 2,500,000 observations. Which one of the following represents the possible values for PTOBS? Given the SAS date sets CLASS1 and CLASS2 CLASS1 CLASS2 NAME COURSE NAME COURSE Lauren MATH1 Smith MATH2 Patel MATH1 Farmer MATH2 Chang MATH1 Patel MATH2 Chang MATH3 Hiller MATH2 The following SAS program is submitted: Proc sql; Select name from CLASS1 <insert SQL set operator here> select name from CLASS; quit; The following output is desired NAME Chang Chang Lauren Which SQL set operator completes the program and generates the desired output? The following SAS program is submitted: %let name = Patel's Restaurant; Which one of the following statements avoids problems associated with the unbalanced quotation mark? Which statement(s) in the DATASETS procedure alter(s) the name of a SAS data set stored in a SAS data library? Given the following SAS data sets ONE and TWO: ONE TWO NUM CHAR1 NUM CHAR2 1 A 2 X 2 B 3 Y 4 D 5 V The following SAS program is submitted creating the output table THREE: data three; set one two; run; THREE NUM CHAR1 CHAR2 1 A 2 B 4 D 2 X 3 Y 5 V Which one of the following SQL programs creates an equivalent SAS data set THREE? Given the following SAS statement: %let idcode = Prod567; Which one of the following statements stores the value 567 in the macro variable CODENUM? The SAS data set WORK.TEMPDATA contains the variable FMTNAME, START and LABEL and it consists of 10 observations. The following SAS program is submitted: proc format cntlin=work.tempdata; run; What is the result of submitting the FORMAT procedure step? The following SAS program is submitted: %macro test(var); proc print data = sasuser.class; where age > &var; run; %mend; Which type of parameter is the macro variable VAR? The following SAS program is submitted: %let value=9; %let add=5; %let newval=%eval(&value/&add); What is the value of the macro variable NEWVAL? Given the following SAS data set ONE: ONE LEVEL AGE 1 10 2 20 3 20 2 10 1 10 2 30 3 10 2 20 3 30 1 10 The following SAS program is submitted: proc sql; select level, max(age) as MAX from one group by level having max(age) > (select avg(age) from one); quit; Which one of the following reports is generated? The following SAS program is submitted: %let lib=%upcase(sauser); proc sql; select nvar form dictionary.tables where libname='&lib"; quit; Several SAS data sets exist in the SAUSER library. What is generated as output? Text is sent to the SAS compiler as a result of macro execution. Which one of the following SAS system options writes that text to the log? What is an advantage of using a hash object in a SAS DATA step? The following SAS program is submitted: data temp; length a 1 b 3 x; infile 'file reference'; input a b x; run; What is the result?

Study Guides