BASE基础操作课后测验(A)

合集下载

SAS Base 50题 带解释【终极版】

SAS Base 50题 带解释【终极版】

SAS 认证考试样题SAS 中文论坛网站1.A raw data file is listed below.1---+----10---+----20---+---son Frank 01/31/89daughter June 12-25-87brother Samuel 01/17/51The following program is submitted using this file as input:data work.family;infile 'file-specification';<insert INPUT statement here >run;Which INPUT statement correctly reads the values for the variable Birthdate as SAS date values?a. i nput relation $ first_name $ birthdate date9.;b.i nput relation $ first_name $ birthdate mmddyy8.; c.i nput relation $ first_name $ birthdate : date9.; d.i nput relation $ first_name $ birthdate : mmddyy8.; Correct answer: dAn informat is used to translate the calendar date to a SAS date value. The date values are in the form of two-digit values for month-day-year, so the MMDDYY8. informat must be used. When using an informat with list input, the colon-format modifier is required to correctly associate the informat with the variable name.You can learn about•informats in Reading Date and Time Values • the colon-format modifier in Reading Free-Format Data .2.A raw data file is listed below.1---+----10---+----20---+---Jose,47,210Sue,,108The following SAS program is submitted using the raw data file above as input:data employeestats;<insert INFILE statement here>input name $ age weight;run;The following output is desired:name age weight Jose 47 210 Sue . 108Which of the following INFILE statements completes the program and accesses the data correctly?a. infile 'file-specification ' pad;b. infile 'file-specification' dsd;SAS 认证考试样题SAS 中文论坛网站c. infile 'file-specification ' dlm=',';d. infile 'file-specification ' missover;Correct answer: bThe PAD option specifies that SAS pad variable length records with blanks. The MISSOVER option prevents SAS from reading past the end of the line when reading free formatted data. The DLM= option specifies the comma as the delimiter; however, consecutive delimiters are treated as one by default. The DSD option correctly reads the data with commas as delimiters and two consecutive commas indicating a missing value like those in this raw data file.You can learn about• the PAD option in Reading Raw Data in Fixed Fields•the MISSOVER option in Creating Multiple Observations from a SingleRecord• the DLM= option and the DSD option in Reading Free-Format Data . 3.The following program is submitted:data numrecords;infile cards dlm=',';input agent1 $ agent2 $ agent3 $;cards;jones,,brownjones,spencer,brown;run;What is the value for the variable named Agent2 in the second observation?a.brown b.spencer c.' ' (missing character value) d. There is no value because only one observation is created.Correct answer: dThe CARDS statement enables you to read instream data. Any number of consecutive commas are considered to be a single delimiter as a result of the DLM= option, and the length of each variable defaults to 8 bytes. Therefore, the values jones , brownjon , and spencer are assigned to Agent1, Agent2, and Agent3, respectively, for the firstobservation. The rest of the data on the record is not read by the INPUT statement and is not output to the data set.You can learn about•the CARDS statement in Creating SAS Data Sets from Raw Data • the default length of variables in Reading Free-Format Data .SAS认证考试样题4.A raw data file is listed below.1---+----10---+----20---+----30---+----40---+----50TWOSTORY 1040 2 1SANDERS ROAD $55,850CONDO 2150 4 2.5JEANS AVENUE $127,150The following program is submitted using this file as input:data work.houses;infile 'file-specification';<insert INPUT statement here>run;Which one of the following INPUT statements reads the raw data file correctly?a.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street 16.@40 price dollar8;b.input @1 style $8+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street $16@40 price dollar8.;c.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street $16.@40 price dollar8.;d.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3street 16.@40 price dollar8.;Correct answer: cFormatted input requires periods as part of the informat name. The period is missing from the variables Style and Street in Answer b, the variable Baths in Answer d, and the variable Price in Answer a (which is also missing a dollar sign to read the variable Street as a character value).You can learn about formatted input and informats in Reading Raw Data in Fixed Fields.5. The following SAS program is submitted at the start of a new SAS session:libname sasdata 'SAS-data-library';data sasdata.sales;set sasdata.salesdata;profit=expenses-revenues;run;SAS中文论坛网站SAS 认证考试样题SAS 中文论坛网站proc print data=sales;run;The SAS data set Sasdata.Salesdata has ten observations. Which one of the following explains why a report fails to generate?a. The DATA step fails execution.b. The SAS data set Sales does not exist.c. The SAS data set Sales has no observations.d. The PRINT procedure contains a syntax error.Correct answer: bThe DATA step creates a permanent SAS data set, Sasdata.Salesdata . The PRINTprocedure is printing a temporary SAS data set, Sales , that is stored in the Work library. At the beginning of the SAS session, Work.Sales does not exist.You can learn about•creating permanent data sets with the DATA step in Creating SAS Data Setsfrom Raw Data• temporary data sets in Basic Concepts . 6. Which action assigns a reference named SALES to a permanent SAS data library? a. Issuing the command:libref SALES 'SAS-data-library'b. Issuing the command:libname SALES 'SAS-data-library'c.Submitting the statement: libref SALES 'SAS-data-library';d. Submitting the statement: libname SALES 'SAS-data-library';Correct answer: dThe LIBNAME statement assigns a reference known as a libref to a permanent SAS data library. The LIBNAME command opens the LIBNAME window.You can learn about the LIBNAME statement in Referencing Files and Setting Options .7. The following SAS program is submitted:data newstaff;set staff;<insert WHERE statement here>run;Which one of the following WHERE statements completes the program and selects only observations with a Hire_date of February 23, 2000?a. where hire_date='23feb2000'd;b. where hire_date='23feb2000';c. where hire_date='02/23/2000'd;SAS 认证考试样题SAS 中文论坛网站d. where hire_date='02/23/2000';Correct answer: aA SAS date constant must take the form of one- or two-digit day, three-digit month, and two- or four-digit year, enclosed in quotation marks and followed by a d('ddmmmyy<yy>'d ).You can learn about SAS date constants in Creating SAS Data Sets from Raw Data .8. Which one of the following SAS date formats displays the SAS date value for January 16, 2002 in the form of 16/01/2002?a. DATE10.b. DDMMYY10.c. WEEKDATE10.d. DDMMYYYY10.Correct answer: bThe requested output is in day-month-year order and is 10 bytes long, so DDMMYY10. is the correct format. Although WEEKDATE10. is a valid SAS format, it does notdisplay the SAS date value as shown in the question above. DDMMYYYY10. is not a valid SAS date format, and the DATE w . format cannot accept a length of 10.You can learn about•the DDMMYY10. format in Creating List Reports • the WEEKDATE10. format in Reading Date and Time Values .9. Which one of the following displays the contents of an external file from within a SAS session?a. the LIST procedureb. the PRINT procedurec. the FSLIST procedured. the VIEWTABLE windowCorrect answer: cThe PRINT procedure and VIEWTABLE window display the values in SAS data sets. The FSLIST procedure displays the values in external files. There is no LIST procedure in SAS.You can learn about• the PRINT procedure in Creating List ReportsSAS 认证考试样题SAS 中文论坛网站• the VIEWTABLE window in Referencing Files and Setting Options .10. The SAS data set Sashelp.Prdsale contains the variables Region and Salary with 4 observations per Region . Sashelp.Prdsale is sorted primarily by Region and within Region by Salary in descending order.The following program is submitted:data one;set sashelp.prdsale;retain temp;by region descending salary;if first.region thendo;temp=salary;output;end;if last.region thendo;range=salary-temp;output;end;run;For each region, what is the number of observation(s) written to the output data set? a. 0b. 1c. 2d. 4Correct answer: cThe expression first.region is true once for each region group. The expression last.region is true once for each region group. Therefore, each OUTPUT statement executes once for a total of 2 observations in the output data set.You can learn about the FIRST.variable expression and the OUTPUT statement in Reading SAS Data Sets .11. The following SAS program is submitted:proc contents data=sasuser.houses;run;The exhibit below contains partial output produced by the CONTENTS procedure. Data Set NameSASUSER.HOUSES Observations 15 Member TypeDATA Variables 6 EngineV9 Indexes 0 CreatedTuesday, April 22, 2003 03:09:25 PMObservation Length 56 Last ModifiedTuesday, April 22, 2003 03:09:25 PMDeleted Observations0 Protection CompressedNOSAS认证考试样题Data Set Type Sorted NOLabel Residential housingfor saleData Representation WINDOWS_32Encoding wlatin1 Western(Windows)Which of the following describes the Sasuser.Houses data set?a.The data set is sorted but not indexed.b.The data set is both sorted and indexed.c.The data set is not sorted but is indexed.d.The data set is neither sorted nor indexed.Correct answer: dThe exhibit above shows partial output from the CONTENTS procedure, In the top right-hand column of the output, you see that Indexes has a value of 0, which indicates that no indexes exist for this data set. Also, Sorted has a value of NO, which indicates that the data is not sorted.You can learn about the CONTENTS procedure in Referencing Files and Setting Options.12.The following SAS program is submitted:proc sort data=work.test;by fname descending salary;run;Which one of the following represents how the observations are sorted?a. The data set Work.Test is stored in ascending order by both Fname and Salary values.b. The data set Work.Test is stored in descending order by both Fname and Salary values.c. The data set Work.Test is stored in descending order by Fname and ascending order by Salary values.d. The data set Work.Test is stored in ascending order by Fname and in descending order by Salary values.Correct answer: dThe DESCENDING keyword is placed before the variable name it modifies in the BY statement, so the correct description is in descending order by Salary value within ascending Fname values.You can learn about the SORT procedure and the DESCENDING keyword in Creating List Reports.13.The following SAS program is submitted:data names;SAS中文论坛网站SAS 认证考试样题SAS 中文论坛网站title='EDU';if title='EDU' thenelse if title='HR' thenDivision='Human Resources';else Division='Unknown';run;Which one of the following represents the value of the variable Division in the output data set?a. Educatiob. Educationc. Human Red. Human ResourcesCorrect answer: bThe length of the variable Division is set to 9 when the DATA step compiles. Since the value of the variable Title is EDU , the first IF condition is true; therefore, the value of the variable Division is Education .You can learn about•the length of a variable in Understanding DATA Step Processing • IF-THEN statements in Creating and Managing Variables .14.Which one of the following SAS programs creates a variable named City with a value of Chicago ?a. data work.airports;AirportCode='ord';if AirportCode='ORD' City='Chicago';run;b.data work.airports; AirportCode='ORD';if AirportCode='ORD' City='Chicago';run;c.data work.airports; AirportCode='ORD';if AirportCode='ORD' then City='Chicago';run;d.data work.airports; AirportCode='ORD';if AirportCode='ORD';then City='Chicago';run;Correct answer: cThe correct syntax for an IF-THEN statement is: IF expression THEN statement ; In this example, the variable City is assigned a value of Chicago only if the expression AirportCode='ORD' is true.SAS 认证考试样题SAS 中文论坛网站You can learn about IF-THEN statements in Creating and Managing Variables .15.The following SAS program is submitted:data work.building;code='DAL523';code='SANFRAN604';code='HOUS731';length code $ 20;run;Which one of the following is the length of the code variable?a. 6b. 7c. 10d. 20Correct answer: a The DATA step first goes through a compilation phase, then an execution phase. The length of a variable is set during the compilation phase and is based on the first time the variable is encountered. In this case, the variable code is set to the length of the text string DAL523 which is 6 characters long. The next assignment statements are ignored during compilation. The LENGTH statement is also ignored since the length has already been established, but a note will be written to the log.You can learn about•the compilation phase of the DATA step in Understanding DATA StepProcessing• the LENGTH statement in Creating and Managing Variables .16. Which of the following statements creates a numeric variable named IDnumber with a value of 4198?a. IDnumber=4198;b. IDnumber='4198';c. length IDnumber=8;d. length IDnumber $ 8;Correct answer: aThe first reference to the SAS variable in the DATA step sets the name, type, and length of the variable in the program data vector (PDV) and in the output SAS data set. The assignment statement IDnumber=4198; is the first reference and creates a numeric variable named IDnumber with a default storage length of 8 bytes.You can learn about• creating variables in the DATA step in Understanding DATA Step ProcessingSAS 认证考试样题SAS 中文论坛网站• numeric variables in Basic Concepts .17. The following program is submitted:data fltaten;input jobcode $ salary name $;cards;FLAT1 70000 BobFLAT2 60000 JoeFLAT3 30000 Ann;run;data desc;set fltaten;if salary>60000 then description='Over 60';else description='Under 60';run;What is value of the variable named description when the value for salary is 30000? a.Under 6 b.Under 60 c.Over 60 d. ' ' (missing character value)Correct answer: aThe variable description is being created by the IF-THEN/ELSE statement during compilation. The first occurrence of the variable description is on the IF statement, and since it is assigned the value Over 60, the length of the variable is 7. Therefore, for the salary value of 30000, description has the value of Under 6 (the 0 is truncated.) You can learn about•the compilation phase of the DATA step in Understanding DATA StepProcessing• IF-THEN/ELSE statements in Creating and Managing Variables .18. A raw data file is listed below.1---+----10---+----20---+---10232015The following program is submitted:data all_sales;infile 'file-specification';input receipts;<insert statement(s) here>run;SAS 认证考试样题SAS 中文论坛网站Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable?a. total+receipts;b.total 0; sum total;c. total=total+receipts;d. total=sum(total,receipts);Correct answer: aThe SUM function and the assignment statement do not retain values across iterations of the DATA step. The sum statement total+receipts; initializes total to 0, ignores missing values of receipt , retains the value of total from one iteration to the next, and adds the value of receipts to total .You can learn about the sum statement in Creating and Managing Variables .19.A raw data file is listed below.1---+----10---+----20---+---1901 21905 11910 61925 11941 1The following SAS program is submitted and references the raw data file above: data money;infile 'file-specification';input year quantity;total=total+quantity;run;What is the value of total when the data step finishes executing?a.0 b.1 c.11 d. . (missing numeric value)Correct answer: dThe variable Total is assigned a missing value during the compilation phase of the DATA step. When the first record is read in, SAS processes: total=.+2; which results in a missing value. Therefore the variable Total remains missing for all observations. You can learn about• the compilation phase of the DATA step in Understanding DATA StepProcessingSAS 认证考试样题SAS 中文论坛网站• using missing values with arithmetic operators in Creating SAS Data Sets fromRaw Data .20.The following program is submitted:data test;average=mean(6,4,.,2);run;What is the value of average ?a.0 b.3 c.4 d. . (missing numeric value)Correct answer: cThe MEAN function adds all of the non-missing values and divides by the number of non-missing values. In this case, 6 + 4 + 2 divided by 3 is 4.You can learn about the MEAN function in Transforming Data with SAS Functions .21.The following SAS program is submitted:data work.AreaCodes;Phonenumber=3125551212;Code='('!!substr(Phonenumber,1,3)!!')';run;Which one of the following is the value of the variable Code in the output data set? a. ( 3)b. (312)c. 3d. 312Correct answer: aAn automatic data conversion is performed whenever a numeric variable is used where SAS expects a character value. The numeric variable is written with the BEST12. format and the resulting character value is right-aligned when the conversion occurs. In this example, the value of Phonenumber is converted to character and right-aligned before the SUBSTR function is performed. Since there are only 10 digits in the value ofPhonenumber , the right-aligned value begins with two blanks. Therefore the SUBSTR function picks up two blanks and a 3, and uses the BEST12. format to assign that value to Code . Then, the parentheses are concatenated before and after the two blanks and a 3. You can learn about automatic data conversion and the SUBSTR function inTransforming Data with SAS Functions .22.The following SAS program is submitted:data work.inventory;products=7;SAS 认证考试样题SAS 中文论坛网站do until (products gt 6);products+1;end;run;Which one of the following is the value of the variable products in the output data set? a. 5b. 6c. 7d. 8Correct answer: dA DO UNTIL loop always executes at least once because the condition is not evaluated until the bottom of the loop. In the SAS program above, the value of Products isincremented from 7 to 8 on the first iteration of the DO UNTIL loop, before the condition is checked. Therefore the value of Products is 8.You can learn about DO UNTIL loops in Generating Data with DO Loops .23.The following program is submitted:data work.test;set work.staff (keep=salary1 salary2 salary3);<insert ARRAY statement here>run;Which ARRAY statement completes the program and creates new variables?a. array salary{3};b. array new_salary{3};c. array salary{3} salary1-salary3;d. array new_salary{3} salary1-salary3;Correct answer: bAlthough each of the ARRAY statements listed above is a valid statement, only AnswerB creates new variables named new_salary1, new_salary2 and new_salary3. AnswerC and AnswerD both create an array that groups the existing data set variables salary1, salary2, and salary3. Since the array in Answer A is named salary , it also uses the existing data set variables.You can learn about creating new variables in an ARRAY statement in Processing Variables with Arrays .24.Which of the following permanently associates a format with a variable?a. the FORMAT procedureb. a FORMAT statement in a DATA stepc. an INPUT function with format modifiersd. an INPUT statement with formatted style inputCorrect answer: bSAS 认证考试样题SAS 中文论坛网站To permanently associate a format with a variable, you use the FORMAT statement in a DATA step. You can use the FORMAT procedure to create a user-defined format. You use the INPUT function to convert character data values to numeric values with an informat. You use the INPUT statement to read data into a data set with an informat. You can learn about•permanently assigning a format to a variable in Creating and Managing Variables •the FORMAT statement in Creating List Reports •the FORMAT procedure in Creating and Applying User-Defined Formats •the INPUT function in Transforming Data with SAS Functions • the INPUT statement in Reading Raw Data in Fixed Fields .25.The following report is generated:Styleof homesn A skingPriceCONDO 4 $99,313RANCH 4 $68,575SPLIT3 $77,983 TWOSTORY4 $83,825Which of the following steps created the report?a. proc freq data=sasuser.houses;tables style price /nocum;format price dollar10.;label style="Style of homes"price="Asking price";run;b.proc print data=sasuser.houses; class style;var price;table style,n price*mean*f=dollar10.;label style="Style of homes"price="Asking price";run;c.proc means data=sasuser.houses n mean; class style;var price;format price dollar10.;label style="Style of homes"price="Asking price";run;d.proc report data=sasuser.houses nowd headline; column style n price;define style / group "Style of homes";define price / mean format=dollar8."Asking price";run;SAS认证考试样题Correct answer: dThe FREQ procedure cannot create the average asking price. The CLASS statement and the VAR statement are not valid for use with the PRINT procedure. The MEANS procedure output would have both the N statistic and the N Obs statistic since a CLASS statement is used. The REPORT procedure produced the report.You can learn about•the FREQ procedure in Producing Descriptive Statistics•the PRINT procedure in Creating List Reports•the MEANS procedure in Producing Descriptive Statistics•the REPORT procedure in Creating Enhanced List and Summary Reports. 26.A SAS report currently flows over two pages because it is too long to fit within the specified display dimension. Which one of the following actions would change the display dimension so that the report fits on one page?a.Increase the value of the LINENO option.b.Decrease the value of the PAGENO option.c.Decrease the value of the LINESIZE option.d.Increase the value of the PAGESIZE option.Correct answer: dThe PAGESIZE= SAS system option controls the number of lines that compose a page of SAS procedure output. By increasing the number of lines available per page, the report might fit on one page.You can learn about the PAGESIZE= option in Referencing Files and Setting Options.27.Which one of the following SAS REPORT procedure options controls how column headings are displayed over multiple lines?a. SPACE=b. SPLIT=c. LABEL=d. BREAK=Correct answer: bThe SPLIT= option specifies how to split column headings. The SPACE=, LABEL= and BREAK= options are not valid options in PROC REPORT.You can learn about the SPLIT= option for the REPORT procedure in Creating Enhanced List and Summary Reports.SAS中文论坛网站SAS认证考试样题28.The following SAS program is submitted:ods html file='newfile.html';proc print data=sasuser.houses;run;proc means data=sasuser.houses;run;proc freq data=sasuser.shoes;run;ods html close;proc print data=sasuser.shoes;run;How many HTML files are created?a. 1b. 2c. 3d. 4Correct answer: aBy default, one HTML file is created for each FILE= option or BODY= option in the ODS HTML statement. The ODS HTML CLOSE statement closes the open HTML file and ends the output capture. The Newfile.html file contains the output from the PRINT, MEANS, and FREQ procedures.You can learn about the ODS HTML statement in Producing HTML Output.29.A frequency report of the variable Jobcode in the Work.Actors data set is listed below.Jobcode Frequency Percent CumulativeFrequency CumulativePercentActor I233.33233.33Actor II233.33466.67Actor III233.336100.00Frequency Missing = 1The following SAS program is submitted:data work.joblevels;set work.actors;if jobcode in ('Actor I', 'Actor II') thenjoblevel='Beginner';if jobcode='Actor III' thenjoblevel='Advanced';else joblevel='Unknown';run;Which of the following represents the possible values for the variable joblevel in the Work.Joblevels data set?a.Advanced and Unknown onlySAS中文论坛网站SAS 认证考试样题SAS 中文论坛网站b. Beginner and Advanced onlyc. Beginner , Advanced , and Unknownd. ' ' (missing character value)Correct answer: aThe DATA step will continue to process those observations that satisfy the condition in the first IF statement Although Joblevel might be set to Beginner for one or more observations, the condition on the second IF statement will evaluate as false, and the ELSE statement will execute and overwrite the value of Joblevel as Unknown .You can learn about•the IF statement in Creating SAS Data Sets from Raw Data • the ELSE statement in Creating and Managing Variables .30.The descriptor and data portions of the Work.Salaries data set are shown below. Variable Type Len Posname Char 8 0salary Char 8 16status Char 8 8name status salary Liz S 15,600 Herman S 26,700 Marty S 35,000The following SAS program is submitted:proc print data=work.salaries;where salary<20000;run;What is displayed in the SAS log after the program is executed?a. A NOTE indicating that 1 observation is read.b. A NOTE indicating that 0 observations were read.c. A WARNING indicating that character values have been converted to numeric values.d. An ERROR indicating that the WHERE clause operator requires compatible variables. Correct answer: dSalary is defined as a character variable. Therefore, the value in the WHERE statement must be the character value 20,000 enclosed in quotation marks.You can learn about the WHERE statement in Creating List Reports .31.Which of the following statements is true when SAS encounters a syntax error in a DATA step?SAS 认证考试样题SAS 中文论坛网站a. The SAS log contains an explanation of the error.b. The DATA step continues to execute and the resulting data set is complete.c. The DATA step stops executing at the point of the error and the resulting data set contains observations up to that point.d. A note appears in the SAS log indicating that the incorrect statement was saved to a SAS data set for further examination.Correct answer: aSAS scans the DATA step for syntax errors during the compilation phase. If there are syntax errors, those errors get written to the log. Most syntax errors prevent further processing of the DATA step.You can learn about how SAS handles syntax errors in the DATA step in Understanding DATA Step Processing .32.Which TITLE statement would display JANE'S DOG as the text of the title?a. title "JANE"S DOG";b. title 'JANE"S DOG';c. title "JANE'S DOG";d. title 'JANE' ' 'S DOG';Correct answer: cThe title in a TITLE statement must be enclosed in a pair of matched quotation marks. Unbalanced quotation marks can cause problems for SAS. To hide an unmatched single quotation mark, surround the title text with matched double quotation marks.You can learn about•the TITLE statement in Creating List Reports • unbalanced quotation marks in Editing and Debugging SAS Programs .33.The following SAS program is submitted:data test;input animal1 $ animal2 $mlgrams1 mlgrams2;cards;hummingbird ostrich 54000.39 90800000.87;run;Which one of the following represents the values of each variable in the output data set?a. animal1 animal2 mlgrams1 mlgrams2 hummingb ostrich 54000.39 90800000b. animal1 animal2 mlgrams1 mlgrams2 hummingb ostrich 54000.39 90800000.87c. animal1 animal2 mlgrams1 mlgrams2 hummingbird ostrich 54000.39 90800000d. animal1 animal2 mlgrams1 mlgrams2。

visual basic 程序设计课后习题参考答案

visual basic 程序设计课后习题参考答案
6
[Exit Function] End Function
(4). Function 过程的调用方法: ①直接调用 像使用 VB 内部函数一样,只需写出函数名
和相应的参数即可 ②用 Call 语句调用 与调用 Sub 过程一样来调用 Function
过程,当用这种方法调用 Function 过程时,将会放弃返回值 3、简述 VB 过程中参数传递的两种方式。
第五章 数 组
4
一、选择题
1 2 3 4 5 6 7 8 9 10 DADEBBCCC A
二、填空题
1 2、12、1、3、-1、2 0123 2222
2 2101 4444
3 name、index 4 preserve、erase 5 ubound、lbound
第六章 过 程
一、选择题
1 2 3 4 5 6 7 8 9 10 DCDCBABAB D 11 12 13 14 15 16 17 18 19 20 ACCDABCDB C
二、填空题
1 bas 2 形式、实际 3 a()、Ubound(b)、n=n-1 4 30、70 5 fedcba、static
三、简答题
6 static 7 static 8 12、7 9 visual basic 程序设计 10 -100
1、简述事件过程和通用过程的含义和联系。
5
VB 应用程序是由过程组成的,过程是完成某种特殊功能的一 组独立的程序代码。VB 中的过程有两大类:事件过程和通用过程
Visual basic 程序设计习题参考答案
第一章 Visual basic 程序设计
一、选择题
1 2 3 4 5 6 7 8 9 10
DC
CDCBAC B

SAS-base-考试必备-70真题(附答案)

SAS-base-考试必备-70真题(附答案)

following SAS program is submitted:data ;set ;by Department Gender;if First.<_insert_code_> then Payroll=0;Payroll+Wagerate;if Last.<_insert_code_>;run;The SAS data set is currently ordered by Gender within Department. Which inserted code will accumulate subtotals for each Gender within DepartmentA. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A-------------------------------------the following raw data records in :----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20 Which SAS program correctly produces the desired outputA.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=;run;B.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;$;format Week1-Week5 dollar6.;run;proc print data=;run;C.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=;run;D.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;$;format Week1-Week5 dollar6.;run;proc print data=;run;Answer: C-------------------------------------Excel workbook contains the following four worksheets:EASTWESTNORTHSOUTHThe following program is submitted:libname MYXLS '';Which PROC PRINT step correctly displays the NORTH worksheetA. proc print data=;run;B. proc print data=$;run;C. proc print data=MYXLS.'NORTH'e;run;D. proc print data=MYXLS.'NORTH$'n;run;Answer: D-------------------------------------following SAS program is submitted:data ;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;What is the value of the variable XA. the numeric value 0B. the character value "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.Answer: A-------------------------------------statement specifies that records 1 through 10 are to be read from the raw data fileA. infile '' 1-10;B. input '' stop@10;C. infile '' obs=10;D. input '' stop=10;Answer: C-------------------------------------a SAS program is submitted, the following is written to the SAS log:101 data ;102 set (keep=product month num_Sold Cost);103 if Month='Jan' then output ;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 LOGA. keep=(Product Sales);B. keep Product, Sales;C. keep=Product, Sales;D. keep Product Sales;Answer: D-------------------------------------of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft ExcelA. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXPAnswer: D-------------------------------------SAS data set named contains 10 observations for each department,and is currently ordered by Department. The following SAS program is submitted:data ;set (keep=Department MonthlyWageRate);by Department;if =1 then Payroll=0;Payroll+(MonthlyWageRate*12);if =1;run;Which statement is trueA. 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 data set.D. The values of the variable Payroll represent a monthly total for all values of WAGERATE in the data set.Answer: C-------------------------------------following SAS program is submitted:data ;Cost='$20,000';Discount=.10*Cost;run;What is the resultA. The value of the variable Discount in the output data set is messages are written to the SAS log.B. The value of the variable Discount in the output data set is 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 messages are written to the SAS log.Answer: C 因为有一个$符号-------------------------------------the existing SAS program:proc format;value agegrplow-12 ='Pre-Teen'13-high = 'Teen';run;proc means data=;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:Analysis Variable : HeightNSex Age Obs Minimum Maximum Mean ------------------------------------------------------------------ F Pre-Teen 3Teen 6M Pre-Teen 4Teen 6--------------------------------------------------------------------A. var Height / nobs min max mean maxdec=1;B. proc means data= maxdec=1 ;C. proc means data= min max mean maxdec=1;D. output nobs min max mean maxdec=1;Answer: C-------------------------------------Excel workbook contains the following three worksheets:JANFEBMARWhich statement correctly assigns a library reference to the Excel workbookA. libname qtrdata '';B. libname '' sheets=3;C. libname jan feb mar '';D. libname mydata '' =(jan,feb,mar);Answer: A-------------------------------------following SAS program is submitted:data ;set (keep=Janpt Febpt Marpt);array Diff{3} Difcount1-Difcount3;array Patients{3} Janpt Febpt Marpt;run;What new variables are createdA. Difcount1, Difcount2 and Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3Answer: A-------------------------------------of the following programs correctly invokes the DATA Step Debugger: A.data debug;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;B.data debugger;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;C.data / debug;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;D.data / debugger;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;Answer: c-------------------------------------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.Answer: D-------------------------------------following SAS program is submitted:data ;X='04jul2005'd;DayOfMonth=day(x);MonthOfYear=month(x);Year=year(x);run;What types of variables are DayOfMonth, MonthOfYear, and YearA. 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.Answer: B-------------------------------------the following data step:data ;infile datalines;input City $20.;if City='Tulsa' thenState='OK';Region='Central';if City='Los Angeles' thenState='CA';Region='Western';datalines;TulsaLos AngelesBangor;run;After data step execution, what will data set containA.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA Western Bangor WesternB.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA Western BangorC.City State Region----------- ----- -------Tulsa OK CentralLos Angeles CA Western Bangor WesternD.City State Region----------- ----- -------Tulsa OK CentralLos CA Western BangorAnswer: A-------------------------------------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.Answer: C-------------------------------------SAS data set contains a numeric variable named Num and a character variable named Char:Num Char--- ----1 233 231 77The following SAS program is submitted:proc print data=;where Num='1';run;What is outputA.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77D. No output is generated.Answer: D-------------------------------------20. The data set 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 ;format LocalFee CountryFee ;set ;LocalFee=LocalFee/100;CountryFee=CountryFee/100;run;What are the formats of the variables LOCALFEE and COUNTRYFEE in the output datasetA. LocalFee has format of 9. and CountryFee has a format of 7.B. LocalFee has format of 9. and CountryFee has a format ofC. Both LocalFee and CountryFee have a format ofD. The data step fails execution; there is no format for LocalFee.Answer: C-------------------------------------the SAS data set :ProdId Price ProductType Sales Returns------ ----- ----------- ----- -------K12S OUTDOOR 15 2B132S CLOTHING 300 10R18KY2 EQUIPMENT 25 53KL8BY OUTDOOR 125 15DY65DW OUTDOOR 45 5DGTY23 EQUIPMENT 67 2The following SAS program is submitted:data ;set ;if Sales GT 30;if ProductType EQ 'OUTDOOR' then output ;else if ProductType EQ 'CLOTHING' then output ;else if ProductType EQ 'EQUIPMENT' then output ;run;How many observations does the data set containA. 1B. 2C. 3D. 6Answer: B-------------------------------------step displays a listing of all the data sets in the WORK libraryA. proc contents lib=WORK run;B. proc contents lib=;run;C. proc contents data=; run;D. proc contents data=WORK _ALL_; run;Answer: c-------------------------------------is a valid LIBNAME statementA. 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_";Answer: C-------------------------------------the following raw data records:----|----10---|----20---|----30Susan*12/29/1970*10Michael**6The following output is desired:Obs employee bdate years1 Susan 4015 102 Michael . 6Which SAS program correctly reads in the raw dataA.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;Answer: D-------------------------------------the following code:proc print data=(firstobs=5 obs=15);where Sex='M';run;How many observations will be displayedA. 11B. 15C. 10 or fewerD. 11 or fewerAnswer: D-------------------------------------step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data setA.proc sort out=EMPLOYEES data=EMPSORT;by Lname and Fname;run;B.proc sort data= out=EMPSORT;by Lname Fname;run;C.proc sort out= data=;by Lname Fname;run;D.proc sort data= out=;by Lname and Fname;run;Answer: B------------------------------------- the SAS data set :Day Month Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89The following program is submitted:proc sort data=;by descending Month Day;run;proc print data=;run;Which output is correctA.Obs Day Month Temp --- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Month Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Obs Day Month Temp --- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Obs Day Month Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85Answer: C------------------------------------- the SAS data set :Location Pop2000-------- -------Alaska 626931Delaware 783595Vermont 608826Wyoming 493782and the SAS data set :State Pop2008-------- -------Alaska 686293Delaware 873092Wyoming 532668The following output is desired:Obs State Pop2000 Pop2008 Difference1 Alaska 626931 686293 593622 Delaware 783595 873092 894973 Wyoming 493782 532668 38886 Which SAS program correctly combines the dataA.data compare;merge (in=_a Location=State)(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;B.data compare;merge (rename=(Location=State));by State;if _a and _b;Difference=Pop2008-Pop2000;run;C.data compare;merge (in=_a rename=(Location=State))(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;D.data compare;merge (in=_a) (rename=(Location=State)) (in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;Answer: C-------------------------------------following SAS program is sumbitted:data ;infile '';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 stepA. 1B. 2C. 3D. 4Answer: A-------------------------------------'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: ----+----1----+----2----+----3----+----4----+----5--4 120104 F 46#30 11MAY1954 33Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061_ERROR_=1 _N_=4NOTE: 20 records were read from the infile 'c:\'.The minimum record length was 33.The maximum record length was 33.NOTE: The data set has 20 observations and 4 variables.What does it meanA. 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------------------------------------------------------------------31. Given the following raw data records in :----|----10---|----20---|----30Kim,Basketball,Golf,TennisBill,FootballTracy,Soccer,TrackThe following program is submitted:data ;length Fname Sport1-Sport3 $ 10;infile '' dlm=',';input Fname $ Sport1 $ Sport2 $ Sport3 $;run;proc print data=;run;Which output is correct based on the submitted programA.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football3 Tracy Soccer TrackB.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Football Football3 Tracy Soccer Track TrackC.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Tracy SoccerD.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill FootballAnswer: C------------------------------------------------------------------ the following data step:data ;set ;Count+1;run;The variable Count is created using a sum statement. Which statement regarding this variable is trueA. 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------------------------------------------------------------------following SAS program is submitted:data ;set ;if Jobcode='Pilot2' then Description='Senior Pilot';else Description='Unknown';run;The value for the variable Jobcode is: is the value of the variable DescriptionA. PILOT2B. UnknownC. Senior PilotD. ' ' (missing character value)Answer: B------------------------------------------------------------------ user-defined format has been created using the FORMAT is it storedA. in a SAS catalogB. in a memory resident lookup tableC. in a SAS dataset in the WORK libraryD. in a SAS dataset in a permanent SAS data libraryAnswer: AThese formats must be stored in the or catalog------------------------------------------------------------------ the SAS data set :X Y-- --5 23 15 6The following SAS program is submitted:data OTHER;set ;if X eq 5 then output ;if Y lt 5 then output ;output;run;What is the resultA.data set has 5 observationsdata set has 5 observationsdata set has 3 observationsB.data set has 2 observationsdata set has 2 observationsdata set has 1 observationsC.data set has 2 observationsdata set has 2 observationsdata set has 5 observationsD. No data sets are output. The DATA step fails execution due to syntax errors.Answer: A------------------------------------------------------------------ the contents of the raw data file '':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTGJorge 3 14 2004 EDUCThe following SAS program is submitted:data ;infile '';input@1 FirstName $@15 StartDate@25 Department $;run;Which SAS informat correctly completes the programA. date9.B. mmddyy10.C. ddmmyy10.D. mondayyr10.Answer: B-------------------------------------------------------------SAS data set contains a variable Open_Date which hasbeen assigned a permanent label of "Open Date". Which SAS program temporarilyreplaces the label "Open Date" with the label "Starting Date" in the outputA.proc print data= label;label Open_Date "Starting Date";run;B.proc print data= label;label Open_Date="Starting Date";run;C.proc print data=;label Open_Date="Starting Date";run;D.proc print data=;Open_Date="Starting Date";run;Answer: B------------------------------------------------------------------ the SAS data set :X Y Z- - --1 A 271 A 331 B 452 A 522 B 693 B 704 A 824 C 91The following SAS program is submitted:data ;set ;by X Y;if ;run;proc print data= noobs;run;Which report is producedA.X Y Z-- -- --1 B 452 A 522 B 693 B 704 A 824 C 91B.X Y Z-- -- --1 A 271 B 452 A 522 B 693 B 704 A 824 C 91C.X Y Z-- -- --1 A 331 B 452 A 522 B 693 B 704 A 824 C 91D. The PRINT procedure fails because the data set is not created in the DATA step.Answer: B------------------------------------------------------------------following SAS program is submitted:data ;array Favorites{3} $ 8 ('Shakespeare','Hemingway','McCaffrey');run;What is the value of the second variable in the datasetA. HemingwayB. HemingwaC. ' ' (a missing value)D. The program contains errors. No variables are created.Answer: B------------------------------------------------------------------ following SAS program is submitted:data ;Prod=1;do while(Prod LE 6);Prod + 1;end;run;What is the value of the variable Prod in the output data setA. 6B. 7C. 8D. . (missing numeric)Answer: B------------------------------------------------------------------the raw data record in the file :----|----10---|----20---|----30---|Stevens James SALES 304-923-3721 14The following SAS program is submitted:data ;infile '';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 FullNameA. FullName=CATX(' ',EmpFName,EmpLName);B. FullName=CAT(' ',EmpFName,EmpLName);C. FullName=EmpFName!!EmpLName;D. FullName=EmpFName + EmpLName;Answer: A------------------------------------------------------------------following SAS program is submitted:data ;Text='Australia, US, Denmark';Pos=find(Text,'US','i',5);run;What value will SAS assign to PosA. 0B. 1C. 2D. 12Answer: D------------------------------------------------------------------ the SAS data set :order_id customer shipped-------- ------------ ---------9341 Josh Martin 02FEB20099874 Rachel Lords 14MAR200910233 Takashi Sato 07JUL2009The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value, and is shown with the DATE9. format.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_noteA. ship_note=catx(' ','Order',order_id,'shippedon',input(shipped,date9.),'to',customer);B. ship_note=catx(' ','Order',order_id,'shippedon',char(shipped,date9.),'to',customer);C. ship_note=catx(' ','Order',order_id,'shippedon',transwrd(shipped,date9.),'to',customer);D. ship_note=catx(' ','Order',order_id,'shippedon',put(shipped,date9.),'to',customer);Answer: D------------------------------------------------------------------following SAS program is submitted:data ONE TWOset ;run;Assuming that exists, how many temporary and permanent SAS data sets are createdA. 2 temporary and 1 permanent SAS data sets are createdB. 3 temporary and 2 permanent SAS data sets are createdC. 2 temporary and 2 permanent SAS data sets are createdD. there is an error and no new data sets are createdAnswer: D------------------------------------------------------------------ following SAS program is submitted:ods csvall file='c:\';proc print data=;var Name Score Grade;by IdNumber;run;ods csvall close;What is produced as outputA. A file named that can only be opened in Excel.B. A text file named that can be opened in Excel or in any text editor.C. A text file named that can only be opened in a text editor.D. A file named that can only be opened by SAS.Answer: C------------------------------------------------------------------ the SAS data set :Obs Revenue2008 Revenue2009 Revenue2010--- ----------- ----------- -----------1The following SAS program is submitted:data ;set ;Total=mean(of Rev:);run;What value will SAS assign to TotalA. 3B.C.D. The program fails to execute due to errors.Answer: B------------------------------------------------------------------ following output is created by the FREQUENCY procedure:The FREQ ProcedureTable of region by productregion productFrequency|Percent |Row Pct |Col Pct |corn |cotton |oranges | Total---------+--------+--------+--------+EAST | 2 | 1 | 1 | 4| | | || | | || | | |---------+--------+--------+--------+SOUTH | 2 | 2 | 1 | 5| | | || | | || | | |---------+--------+--------+--------+Total 4 3 2 9Which TABLES option(s) would be used to eliminate the row and column counts and just see the frequencies and percentsA. norowcount nocolcountB. freq percentC. norow nocolD. nocountsAnswer: C------------------------------------------------------------------following SAS program is submitted:data ;drop City;infile datalines;inputName $ 1-14 /Address $ 1-14 /City $ 1-12 ;if City='New York ' then input @1 State $2.; else input;datalines;Joe Conley123 Main St.JanesvilleWIJane Ngyuen555 Alpha Ave.New YorkNYJennifer Jason666 Mt. DiabloEurekaCA;What will the data set containA.Name Address State-------------- ---------------- ------Joe Conley 123 Main St.Jane Ngyuen 555 Alpha Ave. NYJennifer Jason 666 Mt. DiabloB.Name Address City State-------------- ---------------- ----------- ------Joe Conley 123 Main St. JanesvilleJane Ngyuen 555 Alpha Ave. New York NYJennifer Jason 666 Mt. Diablo EurekaC.Name Address State-------------- ---------------- ------Jane Ngyuen 555 Alpha Ave. NYD. O observations,there is a syntax error in the data step.Answer: A------------------------------------------------------------------ following SAS program is submitted:data (keep=MonthSales{12});set (keep=Year Product Sales);array MonthSales{12};。

SAS-base-考试必备-70真题(附答案)

SAS-base-考试必备-70真题(附答案)

1.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. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A-------------------------------------2.Given the following raw data records in TEXT:----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20 Which SAS program correctly produces the desired output?A.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXT' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;B.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXT' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXT' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXT' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;Answer: C-------------------------------------3.The Excel workbook REGIONS.XLS contains the following four worksheets:EASTWESTNORTHSOUTHThe 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;Answer: D-------------------------------------4.The following SAS program is submitted:data WORK.DATE_INFO;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;What is the value of the variable X?A. the numeric value 0B. the character value "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.Answer: A-------------------------------------5.Which statement specifies that records 1 through 10 are to be read from the raw data ?A. infile 'customer.txt' 1-10;B. input 'customer.txt' stop@10;C. infile 'customer.txt' obs=10;D. input 'customer.txt' stop=10;Answer: C-------------------------------------6.After 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;Answer: D-------------------------------------7.Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel?A. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXPAnswer: D-------------------------------------8.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.Answer: C-------------------------------------10.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.Answer: C 因为有一个$符号-------------------------------------11.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:Analysis Variable : HeightNSex Age Obs Minimum MaximumMean------------------------------------------------------------------F Pre-Teen 3 51.3 59.8 55.8Teen 6 56.5 66.5 63.0 M Pre-Teen 4 57.3 64.8 59.7 Teen 6 62.5 72.0 66.8 --------------------------------------------------------------------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;Answer: C-------------------------------------12.The Excel workbook QTR1.XLS contains the following three worksheets:JANFEBMARWhich 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);Answer: A-------------------------------------13.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 Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3Answer: A-------------------------------------14.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;Answer: c-------------------------------------15.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.Answer: D-------------------------------------16.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.Answer: B-------------------------------------17.Given the following data step:data WORK.GEO;input City $20.;if City='Tulsa' thenState='OK';Region='Central';if City='Los Angeles' thenState='CA';Region='Western';datalines;TulsaLos AngelesBangor;run;After data step execution, what will data set WORK.GEO contain?A.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangor WesternB.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangorC.City State Region----------- ----- -------Tulsa OK CentralLos Angeles CA WesternBangor WesternD.City State Region----------- ----- -------Tulsa OK CentralLos CA WesternAnswer: A-------------------------------------18.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.Answer: C-------------------------------------19.The SAS data set WORK.ONE contains a numeric variable named Num and a character variable named Char:WORK.ONENum Char--- ----1 233 231 77The following SAS program is submitted:proc print data=WORK.ONE;where Num='1';run;What is output?A.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77D. No output is generated.Answer: D-------------------------------------20. 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.2C. Both LocalFee and CountryFee have a format of percent7.2D. The data step fails execution; there is no format for LocalFee.Answer: C-------------------------------------21.Given the SAS data set WORK.PRODUCTS:ProdId Price ProductType Sales Returns------ ----- ----------- ----- -------K12S 95.50 OUTDOOR 15 2B132S 2.99 CLOTHING 300 10R18KY2 51.99 EQUIPMENT 25 53KL8BY 6.39 OUTDOOR 125 15DY65DW 5.60 OUTDOOR 45 5DGTY23 34.55 EQUIPMENT 67 2The 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. 6Answer: B-------------------------------------22.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;Answer: c-------------------------------------23.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_";Answer: C-------------------------------------24.Given the following raw data records:----|----10---|----20---|----30Susan*12/29/1970*10Michael**6The following output is desired:Obs employee bdate years1 Susan 4015 102 Michael . 6Which SAS program correctly reads in the raw data?A.data employees;infile '' dlm='*';input employee $ bdate : mmddyy10. years;run;B.data employees;infile '' dsd='*';input employee $ bdate mmddyy10. years;run;C.data employees;infile '' dlm dsd;input employee $ bdate mmddyy10. years;run;D.data employees;infile '' dlm='*' dsd;input employee $ bdate : mmddyy10. years;run;Answer: D-------------------------------------25.Given the following code:proc print data=SASHELP.CLASS(firstobs=5 obs=15);where Sex='M';run;How many observations will be displayed?A. 11B. 15C. 10 or fewerD. 11 or fewerAnswer: D-------------------------------------26.Which step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data set?A.proc sort out=EMPLOYEES data=EMPSORT;by Lname and Fname;run;B.proc sort data=SASUSER.EMPLOYEES out=EMPSORT;by Lname Fname;run;C.proc sort out=SASUSER.EMPLOYEES data=WORK.EMPSORT;by Lname Fname;run;D.proc sort data=SASUSER.EMPLOYEES out=SASUSER.EMPSORT;by Lname and Fname;run;Answer: B-------------------------------------27.Given the SAS data set WORK.TEMPS:Day Month Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89The following program is submitted: proc sort data=WORK.TEMPS;by descending Month Day; run;proc print data=WORK.TEMPS; run;Which output is correct?A.Obs Day Month Temp --- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Month Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Obs Day Month Temp --- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Obs Day Month Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85Answer: C-------------------------------------28.Given the SAS data set WORK.P2000:Location Pop2000-------- -------Alaska 626931Delaware 783595Vermont 608826Wyoming 493782and the SAS data set WORK.P2008:State Pop2008-------- -------Alaska 686293Delaware 873092Wyoming 532668The following output is desired:Obs State Pop2000 Pop2008 Difference1 Alaska 626931 686293 593622 Delaware 783595 873092 894973 Wyoming 493782 532668 38886 Which SAS program correctly combines the data?A.data compare;merge WORK.P2000(in=_a Location=State)WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;B.data compare;merge WORK.P2000(rename=(Location=State))WORK.P2008;by State;if _a and _b;Difference=Pop2008-Pop2000;run;C.data compare;merge WORK.P2000(in=_a rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;D.data compare;merge WORK.P2000(in=_a) (rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;Answer: C-------------------------------------29.The following SAS program is sumbitted:data ;infile 'DATA';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. 1B. 2C. 3D. 4Answer: A-------------------------------------30.You're attempting to read a raw data you see the following messages displayed in the SAS Log:NOTE: Invalid data for Salary in line 4 15-23.RULE: ----+----1----+----2----+----3----+----4----+----5--4 120104 F 46#30 11MAY1954 33Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061 _ERROR_=1 _N_=4NOTE: 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------------------------------------------------------------------31. Given the following raw data records in DATA:----|----10---|----20---|----30Kim,Basketball,Golf,TennisBill,FootballTracy,Soccer,TrackThe following program is submitted:data WORK.SPORTS_INFO;length Fname Sport1-Sport3 $ 10;infile 'DATA' dlm=',';input Fname $ Sport1 $ Sport2 $ Sport3 $;run;proc print data=WORK.SPORTS_INFO;run;Which output is correct based on the submitted program?A.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football3 Tracy Soccer TrackB.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Football Football3 Tracy Soccer Track TrackC.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Tracy SoccerD.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill FootballAnswer: C------------------------------------------------------------------32.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------------------------------------------------------------------33.The following SAS program is submitted:data WORK.TEST;set WORK.PILOTS;if Jobcode='Pilot2' then Description='Senior Pilot';else Description='Unknown';run;The value for the variable Jobcode is: PILOT2.What is the value of the variable Description?A. PILOT2B. UnknownC. Senior PilotD. ' ' (missing character value)Answer: B------------------------------------------------------------------34.A user-defined format has been created using the FORMAT procedure.How is it stored?A. in a SAS catalogB. in a memory resident lookup tableC. in a SAS dataset in the WORK libraryD. in a SAS dataset in a permanent SAS data libraryAnswer: AThese formats must be stored in the WORK.FORMATS or SASUSER.FORMATS catalog------------------------------------------------------------------35.given the SAS data set SASDATA.TWO:X Y-- --5 23 15 6The following SAS program is submitted:data SASUSER.ONE SASUSER.TWO OTHER;set SASDATA.TWO;if X eq 5 then output SASUSER.ONE;if Y lt 5 then output SASUSER.TWO;output;run;What is the result?A.data set SASUSER.ONE has 5 observationsdata set SASUSER.TWO has 5 observationsdata set WORK.OTHER has 3 observationsB.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 1 observationsC.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 5 observationsD. No data sets are output. The DATA step fails execution due to syntax errors. Answer: A------------------------------------------------------------------36.Given the contents of the raw data file 'EMPLOYEE.TXT':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTGJorge 3 14 2004 EDUCThe following SAS program is submitted:data WORK.EMPLOYEE;infile 'EMPLOYEE.TXT';input@1 FirstName $@15 StartDate@25 Department $;run;Which SAS informat correctly completes the program?A. date9.B. mmddyy10.C. ddmmyy10.D. mondayyr10.Answer: B-------------------------------------------------------------37.The SAS data set Fed.Banks contains a variable Open_Date which hasbeen 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------------------------------------------------------------------ 38.Given the SAS data set WORK.ONE:X Y Z- - --1 A 271 A 331 B 452 A 522 B 693 B 704 A 824 C 91The following SAS program is submitted:data WORK.TWO;set WORK.ONE;by X Y;if First.Y;run;proc print data=WORK.TWO noobs;run;Which report is produced?A.X Y Z-- -- --1 B 452 A 522 B 693 B 704 A 824 C 91B.X Y Z-- -- --1 A 271 B 452 A 522 B 693 B 704 A 824 C 91C.X Y Z-- -- --1 A 331 B 452 A 522 B 693 B 704 A 824 C 91D. The PRINT procedure fails because the data set WORK.TWO is not created in the DATA step.Answer: B------------------------------------------------------------------39.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. HemingwayB. HemingwaC. ' ' (a missing value)D. The program contains errors. No variables are created.Answer: B------------------------------------------------------------------40.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. 6B. 7C. 8D. . (missing numeric)Answer: B------------------------------------------------------------------41.Given the raw data record in the :----|----10---|----20---|----30---|Stevens James SALES 304-923-3721 14The 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------------------------------------------------------------------42.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. 0B. 1C. 2D. 12Answer: D------------------------------------------------------------------43.Given the SAS data set WORK.ORDERS:WORK.ORDERSorder_id customer shipped-------- ------------ ---------9341 Josh Martin 02FEB20099874 Rachel Lords 14MAR200910233 Takashi Sato 07JUL2009The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value, and is shown with the DATE9. format.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,'shippedon',input(shipped,date9.),'to',customer);B. ship_note=catx(' ','Order',order_id,'shippedon',char(shipped,date9.),'to',customer);C. ship_note=catx(' ','Order',order_id,'shippedon',transwrd(shipped,date9.),'to',customer);D. ship_note=catx(' ','Order',order_id,'shippedon',put(shipped,date9.),'to',customer);Answer: D------------------------------------------------------------------44.The following SAS program is submitted:data ONE TWO SASUSER.TWOset 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 createdB. 3 temporary and 2 permanent SAS data sets are createdC. 2 temporary and 2 permanent SAS data sets are createdD. there is an error and no new data sets are createdAnswer: D------------------------------------------------------------------45.The following SAS program is submitted:ods csvall file='c:\test.cvs';proc print data=WORK.ONE;var Name Score Grade;by IdNumber;run;ods csvall close;What is produced as output?A. A test.cvs that can only be opened in Excel.B. A text test.cvs that can be opened in Excel or in any text editor.C. A text test.cvs that can only be opened in a text editor.D. A test.cvs that can only be opened by SAS.Answer: C------------------------------------------------------------------46.Given the SAS data set WORK.ONE:Obs Revenue2008 Revenue2009 Revenue2010--- ----------- ----------- -----------1 1.2 1.6 2.0The following SAS program is submitted:。

SAS~base~考试必备~70真题(附答案解析)

SAS~base~考试必备~70真题(附答案解析)

1.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. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A-------------------------------------2.Given the following raw data records in TEXTFILE.TXT:----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20Which SAS program correctly produces the desired output?A.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;B.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;Answer: C-------------------------------------3.The Excel workbook REGIONS.XLS contains the following four worksheets:EASTWESTNORTHSOUTHThe 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;Answer: D-------------------------------------4.The following SAS program is submitted:data WORK.DATE_INFO;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;What is the value of the variable X?A. the numeric value 0B. the character value "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.Answer: A-------------------------------------5.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;Answer: C-------------------------------------6.After 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;Answer: D-------------------------------------7.Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel?A. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXPAnswer: D-------------------------------------8.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.Answer: C-------------------------------------10.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.Answer: C 因为有一个$符号-------------------------------------11.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:Analysis Variable : HeightNSex Age Obs Minimum MaximumMean------------------------------------------------------------------F Pre-Teen 3 51.3 59.855.8Teen 6 56.5 66.563.0M Pre-Teen 4 57.3 64.859.7Teen 6 62.5 72.066.8--------------------------------------------------------------------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;Answer: C-------------------------------------12.The Excel workbook QTR1.XLS contains the following three worksheets:JANFEBMARWhich 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); Answer: A-------------------------------------13.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 Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3Answer: A-------------------------------------14.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;Answer: c-------------------------------------15.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.Answer: D-------------------------------------16.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.Answer: B-------------------------------------17.Given the following data step:data WORK.GEO;infile datalines;input City $20.;if City='Tulsa' thenState='OK';Region='Central';if City='Los Angeles' thenState='CA';Region='Western';datalines;TulsaLos AngelesBangor;run;After data step execution, what will data set WORK.GEO contain?A.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangor WesternB.City State Region ----------- ----- ------- Tulsa OK Western Los Angeles CA Western BangorC.City State Region ----------- ----- ------- Tulsa OK Central Los Angeles CA Western Bangor WesternD.City State Region ----------- ----- ------- Tulsa OK Central Los CA Western BangorAnswer: A-------------------------------------18.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.Answer: C-------------------------------------19.The SAS data set WORK.ONE contains a numeric variable named Num and a character variable named Char:WORK.ONENum Char--- ----1 233 231 77The following SAS program is submitted:proc print data=WORK.ONE;where Num='1';run;What is output?A.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77D. No output is generated.Answer: D-------------------------------------20. 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.2C. Both LocalFee and CountryFee have a format of percent7.2D. The data step fails execution; there is no format for LocalFee.Answer: C-------------------------------------21.Given the SAS data set WORK.PRODUCTS:ProdId Price ProductType Sales Returns------ ----- ----------- ----- -------K12S 95.50 OUTDOOR 15 2B132S 2.99 CLOTHING 300 10R18KY2 51.99 EQUIPMENT 25 53KL8BY 6.39 OUTDOOR 125 15DY65DW 5.60 OUTDOOR 45 5 DGTY23 34.55 EQUIPMENT 67 2The following SAS program is submitted:data WORK.OUTDOOR WORK.CLOTH WORK.EQUIP;set WORK.PRODUCTS;if Sales GT 30;if ProductType EQ 'OUTDOOR' then outputWORK.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. 6Answer: B-------------------------------------22.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;Answer: c-------------------------------------23.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_";Answer: C-------------------------------------24.Given the following raw data records:----|----10---|----20---|----30Susan*12/29/1970*10Michael**6The following output is desired:Obs employee bdate years1 Susan 4015 102 Michael . 6Which 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;Answer: D-------------------------------------25.Given the following code:proc print data=SASHELP.CLASS(firstobs=5 obs=15);where Sex='M';run;How many observations will be displayed?A. 11B. 15C. 10 or fewerD. 11 or fewerAnswer: D-------------------------------------26.Which step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data set?A.proc sort out=EMPLOYEES data=EMPSORT;by Lname and Fname;run;B.proc sort data=SASUSER.EMPLOYEES out=EMPSORT;by Lname Fname;run;C.proc sort out=SASUSER.EMPLOYEES data=WORK.EMPSORT;by Lname Fname;run;D.proc sort data=SASUSER.EMPLOYEES out=SASUSER.EMPSORT; by Lname and Fname;run;Answer: B-------------------------------------27.Given the SAS data set WORK.TEMPS:Day Month Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89The following program is submitted:proc sort data=WORK.TEMPS;by descending Month Day; run;proc print data=WORK.TEMPS; run;Which output is correct?A.Obs Day Month Temp--- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Month Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Obs Day Month Temp --- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Obs Day Month Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85Answer: C-------------------------------------28.Given the SAS data set WORK.P2000: Location Pop2000-------- -------Alaska 626931Delaware 783595Vermont 608826Wyoming 493782and the SAS data set WORK.P2008:State Pop2008-------- -------Alaska 686293Delaware 873092Wyoming 532668The following output is desired:Obs State Pop2000 Pop2008 Difference1 Alaska 626931 686293 593622 Delaware 783595 873092 894973 Wyoming 493782 532668 38886 Which SAS program correctly combines the data?A.data compare;merge WORK.P2000(in=_a Location=State)WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;B.data compare;merge WORK.P2000(rename=(Location=State)) WORK.P2008;by State;if _a and _b;Difference=Pop2008-Pop2000;run;C.data compare;merge WORK.P2000(in=_a rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;D.data compare;merge WORK.P2000(in=_a) (rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;Answer: C-------------------------------------29.The following SAS program is sumbitted:data ;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. 1B. 2C. 3D. 4Answer: A-------------------------------------30.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: ----+----1----+----2----+----3----+----4----+----5--4 120104 F 46#30 11MAY1954 33Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061 _ERROR_=1 _N_=4NOTE: 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------------------------------------------------------------------31. Given the following raw data records in DATAFILE.TXT:----|----10---|----20---|----30Kim,Basketball,Golf,TennisBill,FootballTracy,Soccer,TrackThe following program is submitted:data WORK.SPORTS_INFO;length Fname Sport1-Sport3 $ 10;infile 'DATAFILE.TXT' dlm=',';input Fname $ Sport1 $ Sport2 $ Sport3 $;run;proc print data=WORK.SPORTS_INFO;run;Which output is correct based on the submitted program?A.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football3 Tracy Soccer TrackB.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Football Football3 Tracy Soccer Track TrackC.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Tracy SoccerD.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill FootballAnswer: C------------------------------------------------------------------32.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------------------------------------------------------------------33.The following SAS program is submitted:data WORK.TEST;set WORK.PILOTS;if Jobcode='Pilot2' then Description='Senior Pilot';else Description='Unknown';run;The value for the variable Jobcode is: PILOT2.What is the value of the variable Description?A. PILOT2B. UnknownC. Senior PilotD. ' ' (missing character value)Answer: B------------------------------------------------------------------34.A user-defined format has been created using the FORMAT procedure.How is it stored?A. in a SAS catalogB. in a memory resident lookup tableC. in a SAS dataset in the WORK libraryD. in a SAS dataset in a permanent SAS data libraryAnswer: AThese formats must be stored in the WORK.FORMATS or SASUSER.FORMATS catalog------------------------------------------------------------------ 35.given the SAS data set SASDATA.TWO:X Y-- --5 23 15 6The following SAS program is submitted:data SASUSER.ONE SASUSER.TWO OTHER;set SASDATA.TWO;if X eq 5 then output SASUSER.ONE;if Y lt 5 then output SASUSER.TWO;output;run;What is the result?A.data set SASUSER.ONE has 5 observationsdata set SASUSER.TWO has 5 observationsdata set WORK.OTHER has 3 observationsB.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 1 observationsC.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 5 observationsD. No data sets are output. The DATA step fails execution due to syntax errors.Answer: A------------------------------------------------------------------ 36.Given the contents of the raw data file 'EMPLOYEE.TXT':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTGJorge 3 14 2004 EDUCThe following SAS program is submitted:data WORK.EMPLOYEE;infile 'EMPLOYEE.TXT';input@1 FirstName $@15 StartDate@25 Department $;run;Which SAS informat correctly completes the program?A. date9.B. mmddyy10.C. ddmmyy10.D. mondayyr10.Answer: B-------------------------------------------------------------37.The SAS data set Fed.Banks contains a variable Open_Date which has been assigned a permanent label of "Open Date". Which SAS program temporarilyreplaces 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------------------------------------------------------------------ 38.Given the SAS data set WORK.ONE:X Y Z- - --1 A 271 A 331 B 452 A 523 B 704 A 824 C 91The following SAS program is submitted:data WORK.TWO;set WORK.ONE;by X Y;if First.Y;run;proc print data=WORK.TWO noobs; run;Which report is produced?A.X Y Z-- -- --1 B 452 B 693 B 704 A 82 4 C 91B.X Y Z -- -- -- 1 A 271 B 452 A 522 B 693 B 704 A 82 4 C 91C.X Y Z -- -- -- 1 A 33 1 B 452 B 693 B 704 A 824 C 91D. The PRINT procedure fails because the data set WORK.TWO is not created in the DATA step.Answer: B------------------------------------------------------------------39.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. HemingwayB. HemingwaC. ' ' (a missing value)D. The program contains errors. No variables are created.Answer: B------------------------------------------------------------------ 40.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. 6B. 7C. 8D. . (missing numeric)Answer: B。

SASbase考试必备70真题(附答案)

SASbase考试必备70真题(附答案)

t ted:;Y;r;l l=0;a te;d e_>;run;The SAS data set.?rrr: A-------------------------------------I LE.TXT:----|----10---|----20---|----30n tTina,MAR,29,1n te d:$13 $25 $14 $27 .n t $26 $17 $29 $11 $23$15 $18 $12 $13 .n t $29 $14 $19 $27 $20t?A.R S;s $ 7;I LE.TXT' dsd;$;s $;s $;-r6.;run;R S;run;B.R S;s $ 7;v er;$;='FEB' s $;s $;-r6.;run;R S;run;C.R S;h s $ 7;I LE.TXT' dlm=',';$ @;s $;s $;f-r6.;run;R S;run;D.R S;s $ 7;I LE.TXT' dsd @;$;Week s $;s $;-r6.;run;R S;run;r: C-------------------------------------wo: EASTWESTt ted:n s.xls';h eet?;run;$;run;'e;run;$'n;run;r: D-------------------------------------w t ted:I NFO;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;b le X?960"n g v si on.r: A-------------------------------------g h 10 are to be read from them er.txt?m er.txt' 1-10;m er.txt' stop@10;m er.txt' obs=10;m er.txt' stop=10;r: C-------------------------------------a S e n to the SAS log:R Y;o ld Cost);R Y;o ld;1;-----22-w ing: !,!!, &, *, **, +, -, , <=, <>, =, >, >=,AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, OR, ^=, |, ||, ~=.106 run;s in the LOG?);;;c t Sa;r: D-------------------------------------?X PLr: D-------------------------------------t ted:data WORK.;);;l l=0;*12);=1;run;m ent is true?A. T..t men Y data set.Y data set.r: C-------------------------------------a m is sub t ted:L;Cost='$20,000';u nt=.10*Cost;run;t?e n to the SAS log.e n to the SAS log.n g.i c data.e n to the SAS log.r: C 因为有一个$符号-------------------------------------a m:t;age plow-12 ='Pre-Teen'13-high = 'Teen';run;;t;Sex Age;p.;run;tot s:tNu m Mean ------------------------------------------------------------------F Pre-Teen 3 51.3 59.8 55.8Teen 6 56.5 66.5 63.0 M Pre-Teen 4 57.3 64.8 59.7 Teen 6 62.5 72.0 66.8 --------------------------------------------------------------------c=1;c=1 ;dat c=1;c=1;r: C-------------------------------------: JANFEBMARst o ok?t a 'qtr1.xls';s=3;m e jan feb mar 'qtr1.xls';=(jan,feb,mar);r: A-------------------------------------t ted:data WORK.TEST;);-u nt3;;run;e d?u nt3n ts3r: A-------------------------------------g er:A.;S;t ate,2,' ');a l';run;B.data WORK.TES g er;S;t ate,2,' ');a l';run;C.;S;t ate,2,' ');a l';run;D.g er;S;t ate,2,' ');a l';run;r: c-------------------------------------R_?t ion.m ent.n.l ly dro e d.r: D-------------------------------------t ted:I NFO;2005'd;=day(x);(x);Year=year(x);run;of r, and Year?c ter.i c.c ter.D s.r: B-------------------------------------w ing data step:data WORK.GEO;i nes;City $20.;' then='OK';a l';e s' then='CA';r n';i nes;e sr;run;i n?A.C n----------- ----- -------r nr nr nB.n----------- ----- -------r nr nrC.n----------- ----- -------a lr nr nD.City n----------- ----- -------a lr nrr: A-------------------------------------a ticR_?s in a DATA step.e d.C. The _E s in the DATA step..r: C-------------------------------------iChar:WORK.ONENum Char--- ----1 233 231 77t ted:data=WORK.ONE;Num='1';run;t?A.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77a ted.r: D-------------------------------------t of 7.;t ted:U RE;F ee C n t7.2;S TAT;F ee/100;/100;run;e t?t of 9. a t of 7.n t7.2n t7.2t for Lo F ee.r: C-------------------------------------C TS:n s------ ----- ----------- ----- -------O R 15 2I NG 300 10M ENT 25 5O R 125 15O R 45 53M ENT 67 2t ted:;C TS;GT 30;O R;;; run;i n?A. 1B. 2C. 3D. 6r: B-------------------------------------r y?n ts lib=WORK run;n ts lib=WORK.all;run;; run;; run;r: c-------------------------------------m ent?n_";n_";n_";n_";r: C-------------------------------------d s:----|----10---|----20---|----30*12/29/1970*10e l**6e d:4015 10e l . 6in the raw data?A.dat y ees;i on' dlm='*';;run;B.y ees;i on' dsd='*';;run;C.dat y ees;i on' dlm dsd;;run;D.y ees;i on' dlm='*' dsd;;run;r: D-------------------------------------w ing code:o bs=5 obs=15);Sex='M';run;a yed?A. 11B. 15r: D-------------------------------------r ary SAS data set?A.proc sort out=E R T;;run;B.R T;;run;C.R T;;run;D.proc sort R T;;run;r: B-------------------------------------:Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89t ted:;Day; run;; run;c t?A.Temp--- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Temp--- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85r: C-------------------------------------the SAS data set WO:00-------- -------1562:08-------- -------a328e d:2n es the data?A.r e;)(in=_b);;if _a and _b;-00;run;B.r e;));;if _a and _b;-00;run;C.r e;WORK.P))(in=_b);;if _a and _b;-00;run;D.r e;))(in=_b);;if _a and _b;-00;run;r: C-------------------------------------t ted:data ;I LE.TXT';n y $20. @25 St$2. @;@30 Year;@30 City Year;e s;run;t ion of the DATA step?A. 1B. 2C. 3D. 4r: A-------------------------------------a yed in the SAS Log:y in line 4 15-23.RULE: ----+----1----+----2----+----3----+----4----+----5--1954 33-R_=1 _N_=4y ees.dat'.h was 33.h was 33.b les. What does it mean?y.B. An e y.n.y.r: B------------------------------------------------------------------I LE.TXT:----|----10---|----20---|----30sa llt ted:O;-3 $ 10;I LE.TXT' dlm=',';3 $;run;data=WORK.SPOR O;run;a m?A.3sa llrB.3sa llC.Spor3srD.3s2 Bil a llr: C------------------------------------------------------------------w ing data step:data WORK.NEW;set WORK.OLD;+1;run;m ent. Whb le is true?t ion.t ion.l e time.l e time.r: C------------------------------------------------------------------t ted:data WORK.TEST;S;';w n';run;n?2w n)r: B-------------------------------------------------------------------d?o gB. in a mer yr yr: Ao g------------------------------------------------------------------T A.TWO:X Y-- --5 23 15 6t ted:;T A.TWO;if X eq 5 then E R.ONE;E R.TWO;t;run;t?A.n sn sn sB.n sn sn sC.n sn sdata set WORK.OT n ss.r: A------------------------------------------------------------------Y EE.TXT':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTG3 14 2004 EDUCt ted:Y EE;Y EE.TXT';N ame $D ate$;run;a m?.y10.y10..r: B-------------------------------------------------------------hasyt?A.;i ng Date";run;B.;i ng Date";run;C.data=SASU S;i ng Date";run;D.S;i ng Date";run;r: B------------------------------------------------------------------the SAS data set WORK.ONE: X Y Z- - --1 A 271 A 331 B 452 A 522 B 693 B 704 A 824 C 91t ted: data WORK.TWO;set WORK.ONE;by X Y;.Y;run;; run;c ed?A.X Y Z-- -- --1 B 452 A 522 B 693 B 704 A 824 C 91B.X Y Z-- -- --1 A 271 B 452 A 522 B 693 B 704 A 824 C 91C.X Y Z-- -- --1 A 331 B 452 A 522 B 693 B 704 A 824 C 91d uref e d in the DATA step.r: B------------------------------------------------------------------t ted:R S;i tes{3} $ 8 f rey');run;R S?g wayg wa)b les are e d.r: B------------------------------------------------------------------t ted:C TS;Prod=1;(Prod LE 6);Prod + 1;end;run;of t data set?A. 6B. 7C. 8i c)r: B------------------------------------------------------------------.txt:----|----10---|----20---|----30---|304-923-3721 14t ted:S;.txt';s ion;d e_>run;a me?a me);a me);a a me;a me;r: A------------------------------------------------------------------t ted:data WORK.ONE;r k';Pos=find(Text,'US','i',5);run;n to Pos?A. 0B. 1C. 2D. 12r: D------------------------------------------------------------------S:Se d-------- ------------ ---------200920092009,t.n ote,m er name.n".n ote?n otm er);m er);w r m er);m er);r: D------------------------------------------------------------------a m i t ted:E R.TWOE R.ONE;run;e d?e dB. 3 te e de de dr: D------------------------------------------------------------------t ted:l file='c:\test.cvs';data=WORK.ONE;;b er;run;;t?.r.r.test.cvs that can d by SAS.r: C------------------------------------------------------------------the SAS data set WORK.ONE:--- ----------- ----------- -----------1 1.2 1.6 2.0t ted:data WORK.TWO;set WORK.ONE;=mean(of Rev:);run;?A. 3B. 1.6C. 4.8s.r: B------------------------------------------------------------------d ure:d ureof reg c tc te ncy|n t |Row Pct |---------+--------+--------+--------+EAST | 2 | 1 | 1 | 4| 22.22 | 11.11 | 11.11 | 44.44| 50.00 | 25.00 | 25.00 || 50.00 | 33.33 | 50.00 |---------+--------+--------+--------+| 2 | 2 | 1 | 5| 22.22 | 22.22 | 11.11 | 55.56| 40.00 | 40.00 | 20.00 || 50.00 | 66.67 | 50.00 |---------+--------+--------+--------+4 3 2 944.44 33.33 22.22 100.00n ate the row an ts?n tn tsr: C------------------------------------------------------------------ 48.The f t ted:data WORK.TEST;drop City;i nes;Name $ 1-14 /s s $ 1-14 /City $ 1-12 ;$2.;;i nes;y123 Main St.WInAve.New YorkNYoaCA;i n?A.Name Add-------------- ---------------- ------y123 Main St.Ave. NYoB.-------------- ---------------- ----------- ------Ave. New York NYaC.-------------- ---------------- ------Ave. NYin the data step.r: A------------------------------------------------------------------49.The fol t ted:{12}););{12};do i=1 to 12;;end;drop i;run;s.?n.*).C. The k{12}..r: A------------------------------------------------------------------the SAS data set WORK.ONE:Id--- -----111 A158 B329 C644 Dand the SAS data set WORK.TWO:--- -----111 E538 F644 Gt ted:data WORK.BOTH;set WORK.ONE WORK.TWO;by Id;run;n in SAS data set WORK.BOTH?--- ----- -----111 AB.--- ----- -----111 EC.--- ----- -----111 A ED.--- ----- -----644 D Gr: A------------------------------------------------------------------t ted:;run;a m?r y.n ts of the SAS data sets that arer y.r y.data sets.r: D------------------------------------------------------------------A ME:---- -----Jill 1864Jack 2121Joan 4698John 5463E PT:----- ----------c et ingt ted:data WORK.ALL;A ME));;);run;a m?A. 1B. 2C. 3D. 5r: B------------------------------------------------------------------t ted:R Y;;Y;;.De=0;a te);;run;?A. 0n ga tet br: B------------------------------------------------------------------w ing data step:data WORK.TEST;(obs=5);';';run;a m is true?A. a ted to 8e d.newi e.a tede d.n ed one time, S.r: D------------------------------------------------------------------t ted:I NFO;1960" D ;run;?1960"960t e.r: D 注意D前面有空格------------------------------------------------------------------d ure:d urec tc te ncy|n t |Row Pct |---------+--------+--------+--------+EAST | 2 | 1 | 1 | 4| 22.22 | 11.11 | 11.11 | 44.44| 50.00 | 25.00 | 25.00 || 50.00 | 33.33 | 50.00 |---------+--------+--------+--------+| 2 | 2 | 1 | 5| 22.22 | 22.22 | 11.11 | 55.56| 40.00 | 40.00 | 20.00 || 50.00 | 66.67 | 50.00 |---------+--------+--------+--------+4 3 2 944.44 33.33 22.22 100.00a mt?;d e_>run;s c t;c tc t;c t;r: D------------------------------------------------------------------the SAS data set WORK.ONE:N Be D ate- ---------20102010t ted:data WORK.TWO;set WORK.ONE;d e_>;.;run;e d, whera y, ... :WORK.TWOD ate Day- --------- ---2010 12010 4e b le Day?D ate)D ate)D ate)())r: B------------------------------------------------------------------a t ted:t;t.-= 'Less than 50K'-e r';o=1;t';;a te;tt..;y ee'y'a te='Date of Hire';run;a m fail?m ent.d ure.m ent.n g f m ent.r: C------------------------------------------------------------------O LOR.DAT:----+----10---+----20---+----30ww ing SAS pr t ted:R S;o ver;hType $ 5$ 11;Type $$;run;?A. T w=ww=r: D------------------------------------------------------------------C TS:n s------ ----- ----------- ----- -------O R 15 2I NG 300 10251.99 EQUI M ENT 25 5O R 125 15O R 45 5M ENT 67 2t ted:data WORK);n s);-n s);run;i n?A. 2B. 3C. 4D. 6r: A------------------------------------------------------------------d er the data step:data WORK.TEST;1.csv' dsd;t;=1;=2;run;?=2;=2;=2;D. both A or C will work.r: A------------------------------------------------------------------t ted:e_>;e r' , 'Boot');run;e_>,d in an html file?A..html';;B..html' / html;;C..html';;D..html';;Answ r: C------------------------------------------------------------------t ted:;(Prod GT 6);Prod + 1;end;run;b le Prod t data set?n g)B. 6C. 7i te loop.r: C------------------------------------------------------------------t ted:data WORK.;;n';run;e t?word).).n.e d in a PROC step.r: C------------------------------------------------------------------t ted:;do Year=1 to 5;=1 to 12;X + 1;end;end;run;n s are wri data set?A. 0B. 1C. 5D. 60r: B------------------------------------------------------------------w ing data step:data WORK.NEW;set WORK.OLD(keep=X);if X < 10 then X=1;else if X >= 10 AND X LT 20 then X=2;else X=3;run;?A.of 1.of 3.n g.s.r: A n g data 最小------------------------------------------------------------------t ted:;;$6;;run;,we t?i c.w n.c ter.a m fail s.r: D------------------------------------------------------------------T A:e r_i ID------- ---------------------- ---------------- ------11111 one oe r'?-e r';-E R';e r ';e r%';r: D------------------------------------------------------------------e n to the SAS log:R Y;i ty Cost);R Y;i ty;i ty Cost;-----22-w ing: !,!!, &, *, **, +, -,, <=, <>, =, >, >=,AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL,, OR, ^=, |, ||, ~=.110 run;in the log?i ty Cost)i ty, Cost)i ty, Cost)i ty Cost)r: D------------------------------------------------------------------。

SASbase考试必备真题(附答案)

SASbase考试必备真题(附答案)

1.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. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A-------------------------------------2.Given the following raw data records in TEXTFILE.TXT:----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20 Which SAS program correctly produces the desired output?A.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;B.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;Answer: C-------------------------------------3.The Excel workbook REGIONS.XLS contains the following four worksheets:EASTWESTNORTHSOUTHThe 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;Answer: D-------------------------------------4.The following SAS program is submitted:data WORK.DATE_INFO;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;What is the value of the variable X?A. the numeric value 0B. the character value "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.Answer: A-------------------------------------5.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;Answer: C-------------------------------------6.After 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;Answer: D-------------------------------------7.Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel?A. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXPAnswer: D-------------------------------------8.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.Answer: C-------------------------------------10.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.Answer: C 因为有一个$符号-------------------------------------11.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:Analysis Variable : HeightNSex Age Obs Minimum MaximumMean------------------------------------------------------------------F Pre-Teen 3 51.3 59.8 55.8Teen 6 56.5 66.5 63.0 M Pre-Teen 4 57.3 64.8 59.7 Teen 6 62.5 72.0 66.8 --------------------------------------------------------------------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;Answer: C-------------------------------------12.The Excel workbook QTR1.XLS contains the following three worksheets:JANFEBMARWhich 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);Answer: A-------------------------------------13.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 Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3Answer: A-------------------------------------14.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;Answer: c-------------------------------------15.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.Answer: D-------------------------------------16.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.Answer: B-------------------------------------17.Given the following data step:data WORK.GEO;infile datalines;input City $20.;if City='Tulsa' thenState='OK';Region='Central';if City='Los Angeles' thenState='CA';Region='Western';datalines;TulsaLos AngelesBangor;run;After data step execution, what will data set WORK.GEO contain?A.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangor WesternB.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangorC.City State Region----------- ----- -------Tulsa OK CentralLos Angeles CA WesternBangor WesternD.City State Region----------- ----- -------Tulsa OK CentralLos CA WesternBangorAnswer: A-------------------------------------18.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.Answer: C-------------------------------------19.The SAS data set WORK.ONE contains a numeric variable named Num and a character variable named Char:WORK.ONENum Char--- ----1 233 231 77The following SAS program is submitted:proc print data=WORK.ONE;where Num='1';run;What is output?A.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77D. No output is generated.Answer: D-------------------------------------20. 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.2C. Both LocalFee and CountryFee have a format of percent7.2D. The data step fails execution; there is no format for LocalFee.Answer: C-------------------------------------21.Given the SAS data set WORK.PRODUCTS:ProdId Price ProductType Sales Returns------ ----- ----------- ----- -------K12S 95.50 OUTDOOR 15 2B132S 2.99 CLOTHING 300 10R18KY2 51.99 EQUIPMENT 25 53KL8BY 6.39 OUTDOOR 125 15DY65DW 5.60 OUTDOOR 45 5DGTY23 34.55 EQUIPMENT 67 2The 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. 6Answer: B-------------------------------------22.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;Answer: c-------------------------------------23.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_";Answer: C-------------------------------------24.Given the following raw data records:----|----10---|----20---|----30Susan*12/29/1970*10Michael**6The following output is desired:Obs employee bdate years1 Susan 4015 102 Michael . 6Which 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;Answer: D-------------------------------------25.Given the following code:proc print data=SASHELP.CLASS(firstobs=5 obs=15);where Sex='M';run;How many observations will be displayed?A. 11B. 15C. 10 or fewerD. 11 or fewerAnswer: D-------------------------------------26.Which step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data set?A.proc sort out=EMPLOYEES data=EMPSORT;by Lname and Fname;run;B.proc sort data=SASUSER.EMPLOYEES out=EMPSORT;by Lname Fname;run;C.proc sort out=SASUSER.EMPLOYEES data=WORK.EMPSORT;by Lname Fname;run;D.proc sort data=SASUSER.EMPLOYEES out=SASUSER.EMPSORT;by Lname and Fname;run;Answer: B-------------------------------------27.Given the SAS data set WORK.TEMPS:Day Month Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89The following program is submitted: proc sort data=WORK.TEMPS;by descending Month Day; run;proc print data=WORK.TEMPS; run;Which output is correct?A.Obs Day Month Temp --- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Month Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Obs Day Month Temp --- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Obs Day Month Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85Answer: C-------------------------------------28.Given the SAS data set WORK.P2000:Location Pop2000-------- -------Alaska 626931Delaware 783595Vermont 608826Wyoming 493782and the SAS data set WORK.P2008:State Pop2008-------- -------Alaska 686293Delaware 873092Wyoming 532668The following output is desired:Obs State Pop2000 Pop2008 Difference1 Alaska 626931 686293 593622 Delaware 783595 873092 894973 Wyoming 493782 532668 38886 Which SAS program correctly combines the data?A.data compare;merge WORK.P2000(in=_a Location=State)WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;B.data compare;merge WORK.P2000(rename=(Location=State))WORK.P2008;by State;if _a and _b;Difference=Pop2008-Pop2000;run;C.data compare;merge WORK.P2000(in=_a rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;D.data compare;merge WORK.P2000(in=_a) (rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;Answer: C-------------------------------------29.The following SAS program is sumbitted:data ;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. 1B. 2C. 3D. 4Answer: A-------------------------------------30.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: ----+----1----+----2----+----3----+----4----+----5--4 120104 F 46#30 11MAY1954 33Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061 _ERROR_=1 _N_=4NOTE: 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------------------------------------------------------------------31. Given the following raw data records in DATAFILE.TXT:----|----10---|----20---|----30Kim,Basketball,Golf,TennisBill,FootballTracy,Soccer,TrackThe following program is submitted:data WORK.SPORTS_INFO;length Fname Sport1-Sport3 $ 10;infile 'DATAFILE.TXT' dlm=',';input Fname $ Sport1 $ Sport2 $ Sport3 $;run;proc print data=WORK.SPORTS_INFO;run;Which output is correct based on the submitted program?A.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football3 Tracy Soccer TrackB.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Football Football3 Tracy Soccer Track TrackC.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Tracy SoccerD.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill FootballAnswer: C------------------------------------------------------------------32.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------------------------------------------------------------------33.The following SAS program is submitted:data WORK.TEST;set WORK.PILOTS;if Jobcode='Pilot2' then Description='Senior Pilot';else Description='Unknown';run;The value for the variable Jobcode is: PILOT2.What is the value of the variable Description?A. PILOT2B. UnknownC. Senior PilotD. ' ' (missing character value)Answer: B------------------------------------------------------------------34.A user-defined format has been created using the FORMAT procedure.How is it stored?A. in a SAS catalogB. in a memory resident lookup tableC. in a SAS dataset in the WORK libraryD. in a SAS dataset in a permanent SAS data libraryAnswer: AThese formats must be stored in the WORK.FORMATS or SASUSER.FORMATS catalog------------------------------------------------------------------35.given the SAS data set SASDATA.TWO:X Y-- --5 23 15 6The following SAS program is submitted:data SASUSER.ONE SASUSER.TWO OTHER;set SASDATA.TWO;if X eq 5 then output SASUSER.ONE;if Y lt 5 then output SASUSER.TWO;output;run;What is the result?A.data set SASUSER.ONE has 5 observationsdata set SASUSER.TWO has 5 observationsdata set WORK.OTHER has 3 observationsB.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 1 observationsC.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 5 observationsD. No data sets are output. The DATA step fails execution due to syntax errors. Answer: A------------------------------------------------------------------36.Given the contents of the raw data file 'EMPLOYEE.TXT':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTGJorge 3 14 2004 EDUCThe following SAS program is submitted:data WORK.EMPLOYEE;infile 'EMPLOYEE.TXT';input@1 FirstName $@15 StartDate@25 Department $;run;Which SAS informat correctly completes the program?A. date9.B. mmddyy10.C. ddmmyy10.D. mondayyr10.Answer: B-------------------------------------------------------------37.The SAS data set Fed.Banks contains a variable Open_Date which hasbeen 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------------------------------------------------------------------ 38.Given the SAS data set WORK.ONE:X Y Z- - --1 A 271 A 331 B 452 A 522 B 693 B 704 A 824 C 91The following SAS program is submitted:data WORK.TWO;set WORK.ONE;by X Y;if First.Y;run;proc print data=WORK.TWO noobs;run;Which report is produced?A.X Y Z-- -- --1 B 452 A 522 B 693 B 704 A 824 C 91B.X Y Z-- -- --1 A 271 B 452 A 522 B 693 B 704 A 824 C 91C.X Y Z-- -- --1 A 331 B 452 A 522 B 693 B 704 A 824 C 91D. The PRINT procedure fails because the data set WORK.TWO is not created in the DATA step.Answer: B------------------------------------------------------------------39.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. HemingwayB. HemingwaC. ' ' (a missing value)D. The program contains errors. No variables are created.Answer: B------------------------------------------------------------------40.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. 6B. 7C. 8D. . (missing numeric)Answer: B------------------------------------------------------------------41.Given the raw data record in the file phone.txt:----|----10---|----20---|----30---|Stevens James SALES 304-923-3721 14The 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------------------------------------------------------------------42.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. 0B. 1C. 2D. 12Answer: D------------------------------------------------------------------43.Given the SAS data set WORK.ORDERS:WORK.ORDERSorder_id customer shipped-------- ------------ ---------9341 Josh Martin 02FEB20099874 Rachel Lords 14MAR200910233 Takashi Sato 07JUL2009The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value, and is shown with the DATE9. format.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,'shippedon',input(shipped,date9.),'to',customer);B. ship_note=catx(' ','Order',order_id,'shippedon',char(shipped,date9.),'to',customer);C. ship_note=catx(' ','Order',order_id,'shippedon',transwrd(shipped,date9.),'to',customer);D. ship_note=catx(' ','Order',order_id,'shippedon',put(shipped,date9.),'to',customer);Answer: D------------------------------------------------------------------44.The following SAS program is submitted:data ONE TWO SASUSER.TWOset 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 createdB. 3 temporary and 2 permanent SAS data sets are createdC. 2 temporary and 2 permanent SAS data sets are createdD. there is an error and no new data sets are createdAnswer: D------------------------------------------------------------------45.The following SAS program is submitted:ods csvall file='c:\test.cvs';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.cvs that can only be opened in Excel.B. A text file named test.cvs that can be opened in Excel or in any text editor.C. A text file named test.cvs that can only be opened in a text editor.D. A file named test.cvs that can only be opened by SAS.Answer: C------------------------------------------------------------------46.Given the SAS data set WORK.ONE:Obs Revenue2008 Revenue2009 Revenue2010--- ----------- ----------- -----------1 1.2 1.6 2.0The following SAS program is submitted:。

Visual Basic基础练习题+答案

Visual Basic基础练习题+答案

Vb基础练习题班级:___________姓名:___________1.在VB集成开发环境中,要进入运行模式,可以执行“运行”菜单中的“启动”命令,也可以单击工具栏上的( )A. B. C. D.2.算法是求解某一问题的步骤和方法。

算法的输出结果至少应有( )。

A.0个 B.1个 C.2个 D.3个3.在VB中,用来描述对象的外部特征称为对象的( )。

A.事件 B.方法 C.属性 D.驱动4.VB中标签控件(Label)具有的功能是()。

A.输入文本 B.显示文本 C .计时 D.显示时间5.如下图所示,在Visual Basic工程设计中,要在命令按钮command1中显示“确定”,则下列操作正确的是( )A.在Text属性值中输入“确定”B.在Caption属性值中输入“确定”C.在Font属性值中输入“确定”D.在Name属性值中输入“确定”6.下列关于"控件"属性的说法正确的是( )A、控件的每一个属性都具有同样的默认值;B、所有对象都具有同样的属性;C、控件的属性只能在设计时设置,不能在运行时修改;D、单击窗体中的某控件,在属性窗口中的属性列表框中找到所要设置的属性,即可设置其属性值;7.方小舟同学用VB制作程序界面,如下图所示要将按钮上显示的“Command1”改成“退出”,应该修改的是()。

A.①名称属性 B.②BackColor属性 C.③Caption属性 D.④Default属性8.在Visual Basic 中,赋值语句chepai="浙D .V8888"中的"浙D .V8888"是( ) A .字符串常量 B .数值常量 C .逻辑常量 D .实数常量 9.在VB 中,下列选项属于字符串型数据的是( )A .2356B ."BX277"C .BX277D .2014-5-28 10.在Visual Basic 代码窗口中,语句Student.Text="宋知国"中的Text 是( ) A 、属性值 B 、属性名 C 、对象名 D 、窗口名 11. 以下合法的变量名是( )A .A-B B .forC . a_1D .4S 12.以下哪个是函数_____。

SAS-base-考试必备-70真题(附答案)

SAS-base-考试必备-70真题(附答案)

following SAS program is submitted:data ;set ;by Department Gender;if First.<_insert_code_> then Payroll=0;Payroll+Wagerate;if Last.<_insert_code_>;run;The SAS data set is currently ordered by Gender within Department.Which inserted code will accumulate subtotals for each Gender within DepartmentA. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A-------------------------------------the following raw data records in :----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20 Which SAS program correctly produces the desired outputA.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=;run;B.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=;run;C.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=;run;D.data ;length Name $ 4 Month $ 3 Status $ 7;infile '' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=;run;Answer: CExcel workbook contains the following four worksheets:EASTWESTNORTHSOUTHThe following program is submitted:libname MYXLS '';Which PROC PRINT step correctly displays the NORTH worksheetA. proc print data=;run;B. proc print data=$;run;C. proc print data=MYXLS.'NORTH'e;run;D. proc print data=MYXLS.'NORTH$'n;run;Answer: D-------------------------------------following SAS program is submitted:data ;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;What is the value of the variable XA. the numeric value 0B. the character value "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.Answer: A-------------------------------------statement specifies that records 1 through 10 are to be read from the raw data fileA. infile '' 1-10;B. input '' stop@10;C. infile '' obs=10;D. input '' stop=10;Answer: Ca SAS program is submitted, the following is written to the SAS log:101 data ;102 set (keep=product month num_Sold Cost);103 if Month='Jan' then output ;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 LOGA. keep=(Product Sales);B. keep Product, Sales;C. keep=Product, Sales;D. keep Product Sales;Answer: D-------------------------------------of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft ExcelA. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXPAnswer: D-------------------------------------SAS data set named contains 10 observations for each department,and is currently ordered by Department. The following SAS program is submitted:data ;set (keep=Department MonthlyWageRate);by Department;if =1 then Payroll=0;Payroll+(MonthlyWageRate*12);if =1;run;Which statement is trueA. 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 data set.D. The values of the variable Payroll represent a monthly total for all values of WAGERATE in the data set.Answer: C-------------------------------------following SAS program is submitted:data ;Cost='$20,000';Discount=.10*Cost;run;What is the resultA. The value of the variable Discount in the output data set is messages are written to the SAS log.B. The value of the variable Discount in the output data set is 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 messages are written to the SAS log.Answer: C 因为有一个$符号-------------------------------------the existing SAS program:proc format;value agegrplow-12 ='Pre-Teen'13-high = 'Teen';run;proc means data=;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:Analysis Variable : HeightNSex Age Obs Minimum MaximumMean------------------------------------------------------------------F Pre-Teen 3Teen 6M Pre-Teen 4Teen 6--------------------------------------------------------------------A. var Height / nobs min max mean maxdec=1;B. proc means data= maxdec=1 ;C. proc means data= min max mean maxdec=1;D. output nobs min max mean maxdec=1;Answer: C-------------------------------------Excel workbook contains the following three worksheets:JANFEBMARWhich statement correctly assigns a library reference to the Excel workbookA. libname qtrdata '';B. libname '' sheets=3;C. libname jan feb mar '';D. libname mydata '' =(jan,feb,mar);Answer: A-------------------------------------following SAS program is submitted:data ;set (keep=Janpt Febpt Marpt);array Diff{3} Difcount1-Difcount3;array Patients{3} Janpt Febpt Marpt;run;What new variables are createdA. Difcount1, Difcount2 and Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3Answer: A-------------------------------------of the following programs correctly invokes the DATA Step Debugger: A.data debug;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;B.data debugger;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;C.data / debug;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;D.data / debugger;set ;State=scan(cityState,2,' ');if State='NE' then description='Central';run;Answer: c-------------------------------------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.Answer: D-------------------------------------following SAS program is submitted:data ;X='04jul2005'd;DayOfMonth=day(x);MonthOfYear=month(x);Year=year(x);run;What types of variables are DayOfMonth, MonthOfYear, and YearA. 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. Answer: B-------------------------------------the following data step:data ;infile datalines;input City $20.;if City='Tulsa' thenState='OK';Region='Central';if City='Los Angeles' thenState='CA';Region='Western';datalines;TulsaLos AngelesBangor;run;After data step execution, what will data set contain A.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangor WesternB.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangorC.City State Region----------- ----- -------Tulsa OK CentralLos Angeles CA WesternBangor WesternD.City State Region----------- ----- -------Tulsa OK CentralLos CA WesternBangorAnswer: A-------------------------------------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.Answer: C-------------------------------------SAS data set contains a numeric variable named Num and a character variable named Char:Num Char--- ----1 233 231 77The following SAS program is submitted:proc print data=;where Num='1';run;What is outputA.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77D. No output is generated.Answer: D-------------------------------------20. The data set 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 ;format LocalFee CountryFee ;set ;LocalFee=LocalFee/100;CountryFee=CountryFee/100;run;What are the formats of the variables LOCALFEE and COUNTRYFEE in the output datasetA. LocalFee has format of 9. and CountryFee has a format of 7.B. LocalFee has format of 9. and CountryFee has a format ofC. Both LocalFee and CountryFee have a format ofD. The data step fails execution; there is no format for LocalFee. Answer: C-------------------------------------the SAS data set :ProdId Price ProductType Sales Returns------ ----- ----------- ----- -------K12S OUTDOOR 15 2B132S CLOTHING 300 10R18KY2 EQUIPMENT 25 53KL8BY OUTDOOR 125 15 DY65DW OUTDOOR 45 5 DGTY23 EQUIPMENT 67 2The following SAS program is submitted:data ;set ;if Sales GT 30;if ProductType EQ 'OUTDOOR' then output ;else if ProductType EQ 'CLOTHING' then output ;else if ProductType EQ 'EQUIPMENT' then output ;run;How many observations does the data set containA. 1B. 2C. 3D. 6Answer: B-------------------------------------step displays a listing of all the data sets in the WORK libraryA. proc contents lib=WORK run;B. proc contents lib=;run;C. proc contents data=; run;D. proc contents data=WORK _ALL_; run;Answer: c-------------------------------------is a valid LIBNAME statementA. 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_";Answer: C-------------------------------------the following raw data records:----|----10---|----20---|----30Susan*12/29/1970*10Michael**6The following output is desired:Obs employee bdate years1 Susan 4015 102 Michael . 6Which 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;Answer: D-------------------------------------the following code:proc print data=(firstobs=5 obs=15);where Sex='M';run;How many observations will be displayedA. 11B. 15C. 10 or fewerD. 11 or fewerAnswer: D-------------------------------------step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data setA.proc sort out=EMPLOYEES data=EMPSORT;by Lname and Fname;run;B.proc sort data= out=EMPSORT;by Lname Fname;run;C.proc sort out= data=;by Lname Fname;run;D.proc sort data= out=;by Lname and Fname;run;Answer: B-------------------------------------the SAS data set :Day Month Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89The following program is submitted: proc sort data=;by descending Month Day; run;proc print data=;run;Which output is correctA.Obs Day Month Temp --- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Month Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Obs Day Month Temp --- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Obs Day Month Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85Answer: C-------------------------------------the SAS data set :Location Pop2000-------- -------Alaska 626931Delaware 783595Vermont 608826Wyoming 493782and the SAS data set :State Pop2008-------- -------Alaska 686293Delaware 873092Wyoming 532668The following output is desired:Obs State Pop2000 Pop2008 Difference1 Alaska 626931 686293 593622 Delaware 783595 873092 894973 Wyoming 493782 532668 38886 Which SAS program correctly combines the dataA.data compare;merge (in=_a Location=State)(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;B.data compare;merge (rename=(Location=State));by State;if _a and _b;Difference=Pop2008-Pop2000;run;C.data compare;merge (in=_a rename=(Location=State))(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;D.data compare;merge (in=_a) (rename=(Location=State))(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;Answer: C-------------------------------------following SAS program is sumbitted:data ;infile '';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 stepA. 1B. 2C. 3D. 4Answer: A-------------------------------------'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: ----+----1----+----2----+----3----+----4----+----5--4 120104 F 46#30 11MAY1954 33Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061 _ERROR_=1 _N_=4NOTE: 20 records were read from the infile 'c:\'.The minimum record length was 33.The maximum record length was 33.NOTE: The data set has 20 observations and 4 variables.What does it meanA. 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------------------------------------------------------------------31. Given the following raw data records in :----|----10---|----20---|----30Kim,Basketball,Golf,TennisBill,FootballTracy,Soccer,TrackThe following program is submitted:data ;length Fname Sport1-Sport3 $ 10;infile '' dlm=',';input Fname $ Sport1 $ Sport2 $ Sport3 $;run;proc print data=;run;Which output is correct based on the submitted program A.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football3 Tracy Soccer TrackB.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Football Football3 Tracy Soccer Track TrackC.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Tracy SoccerD.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill FootballAnswer: C------------------------------------------------------------------the following data step:data ;set ;Count+1;run;The variable Count is created using a sum statement. Which statement regarding this variable is trueA. 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------------------------------------------------------------------following SAS program is submitted:data ;set ;if Jobcode='Pilot2' then Description='Senior Pilot';else Description='Unknown';run;The value for the variable Jobcode is: is the value of the variable DescriptionA. PILOT2B. UnknownC. Senior PilotD. ' ' (missing character value)Answer: B------------------------------------------------------------------user-defined format has been created using the FORMAT is it storedA. in a SAS catalogB. in a memory resident lookup tableC. in a SAS dataset in the WORK libraryD. in a SAS dataset in a permanent SAS data libraryAnswer: AThese formats must be stored in the or catalog------------------------------------------------------------------the SAS data set :X Y-- --5 23 15 6The following SAS program is submitted:data OTHER;set ;if X eq 5 then output ;if Y lt 5 then output ;output;run;What is the resultA.data set has 5 observationsdata set has 5 observationsdata set has 3 observationsB.data set has 2 observationsdata set has 2 observationsdata set has 1 observationsC.data set has 2 observationsdata set has 2 observationsdata set has 5 observationsD. No data sets are output. The DATA step fails execution due to syntax errors. Answer: A------------------------------------------------------------------the contents of the raw data file '':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTGJorge 3 14 2004 EDUCThe following SAS program is submitted:data ;infile '';input@1 FirstName $@15 StartDate@25 Department $;run;Which SAS informat correctly completes the programA. date9.B. mmddyy10.C. ddmmyy10.D. mondayyr10.Answer: B-------------------------------------------------------------SAS data set contains a variable Open_Date which hasbeen 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= label;label Open_Date "Starting Date";run;B.proc print data= label;label Open_Date="Starting Date";run;C.proc print data=;label Open_Date="Starting Date";run;D.proc print data=;Open_Date="Starting Date";run;Answer: B------------------------------------------------------------------the SAS data set :X Y Z- - --1 A 271 A 331 B 452 A 522 B 693 B 704 A 824 C 91The following SAS program is submitted: data ;set ;by X Y;if ;run;proc print data= noobs;run;Which report is producedA.X Y Z-- -- --1 B 452 A 522 B 693 B 704 A 824 C 91B.X Y Z-- -- --1 A 271 B 452 A 522 B 693 B 704 A 824 C 91C.X Y Z-- -- --1 A 331 B 452 A 522 B 693 B 704 A 824 C 91D. The PRINT procedure fails because the data set is not created in the DATA step.Answer: B------------------------------------------------------------------following SAS program is submitted:data ;array Favorites{3} $ 8 ('Shakespeare','Hemingway','McCaffrey');run;What is the value of the second variable in the datasetA. HemingwayB. HemingwaC. ' ' (a missing value)D. The program contains errors. No variables are created.Answer: B------------------------------------------------------------------following SAS program is submitted:data ;Prod=1;do while(Prod LE 6);Prod + 1;end;run;What is the value of the variable Prod in the output data setB. 7C. 8D. . (missing numeric)Answer: B------------------------------------------------------------------the raw data record in the file :----|----10---|----20---|----30---|Stevens James SALES 304-923-3721 14The following SAS program is submitted:data ;infile '';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 FullNameA. FullName=CATX(' ',EmpFName,EmpLName);B. FullName=CAT(' ',EmpFName,EmpLName);C. FullName=EmpFName!!EmpLName;D. FullName=EmpFName + EmpLName;Answer: A------------------------------------------------------------------following SAS program is submitted:data ;Text='Australia, US, Denmark';Pos=find(Text,'US','i',5);run;What value will SAS assign to PosA. 0B. 1C. 2Answer: D------------------------------------------------------------------the SAS data set :order_id customer shipped-------- ------------ ---------9341 Josh Martin 02FEB20099874 Rachel Lords 14MAR200910233 Takashi Sato 07JUL2009The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value, and is shown with the DATE9. format.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_noteA. ship_note=catx(' ','Order',order_id,'shippedon',input(shipped,date9.),'to',customer);B. ship_note=catx(' ','Order',order_id,'shippedon',char(shipped,date9.),'to',customer);C. ship_note=catx(' ','Order',order_id,'shippedon',transwrd(shipped,date9.),'to',customer);D. ship_note=catx(' ','Order',order_id,'shippedon',put(shipped,date9.),'to',customer);Answer: D------------------------------------------------------------------following SAS program is submitted:data ONE TWOset ;run;Assuming that exists, how many temporary and permanent SAS data sets are createdA. 2 temporary and 1 permanent SAS data sets are createdB. 3 temporary and 2 permanent SAS data sets are createdC. 2 temporary and 2 permanent SAS data sets are createdD. there is an error and no new data sets are createdAnswer: D------------------------------------------------------------------following SAS program is submitted:ods csvall file='c:\';proc print data=;var Name Score Grade;by IdNumber;run;ods csvall close;What is produced as outputA. A file named that can only be opened in Excel.B. A text file named that can be opened in Excel or in any text editor.C. A text file named that can only be opened in a text editor.D. A file named that can only be opened by SAS.Answer: C------------------------------------------------------------------the SAS data set :Obs Revenue2008 Revenue2009 Revenue2010--- ----------- ----------- -----------1The following SAS program is submitted:data ;set ;Total=mean(of Rev:);run;What value will SAS assign to TotalA. 3B.C.D. The program fails to execute due to errors.Answer: B------------------------------------------------------------------following output is created by the FREQUENCY procedure:The FREQ ProcedureTable of region by productregion productFrequency|Percent |Row Pct |Col Pct |corn |cotton |oranges | Total---------+--------+--------+--------+EAST | 2 | 1 | 1 | 4| | | || | | || | | |---------+--------+--------+--------+SOUTH | 2 | 2 | 1 | 5| | | || | | || | | |---------+--------+--------+--------+Total 4 3 2 9Which TABLES option(s) would be used to eliminate the row and column counts and just see the frequencies and percentsA. norowcount nocolcountB. freq percentC. norow nocolD. nocountsAnswer: C------------------------------------------------------------------following SAS program is submitted:data ;drop City;infile datalines;inputName $ 1-14 /Address $ 1-14 /City $ 1-12 ;if City='New York ' then input @1 State $2.;else input;datalines;Joe Conley123 Main St.JanesvilleWIJane Ngyuen555 Alpha Ave.New YorkNYJennifer Jason666 Mt. DiabloEurekaCA;What will the data set containA.Name Address State-------------- ---------------- ------Joe Conley 123 Main St.Jane Ngyuen 555 Alpha Ave. NYJennifer Jason 666 Mt. DiabloB.Name Address City State -------------- ---------------- ----------- ------Joe Conley 123 Main St. JanesvilleJane Ngyuen 555 Alpha Ave. New York NY Jennifer Jason 666 Mt. Diablo Eureka。

VisualBasic程序设计基础课后习题参考答案

VisualBasic程序设计基础课后习题参考答案

资料内容仅供您学习参考,如有不当或者侵权,请联系改正或者删除。

第1章 Visual Basic 6.0程序设计概述一、判断题1.√ 2.√3.×说明: 同类控件( 如两个标签) 相互重叠, 设计时能够设置”置前”、”置后”属性。

4.√ 5.× 6.√ 7.× 8.√ 9.√ 10.×11.√ 12.√13.× 14.√ 15.× 16.√ 17.√ 18.√ 19.√20.√二、选择题1. C2. B 3.D 4.C 5.B 6.A 7.D 8.A 9.B 10.A 11.C 12.D三、填空题1.对象、事件 2.属性、方法、事件 3.控件、屏幕( Screen)4.对象 5.Left、 Top 6.属性、 <对象名>.<属性名>=<表示式>7.网格 8.F orm19.Load或Initialize或Resize或Activate( 自动执行的先后顺序也按此排列)10.Activate、 Deactivate四、程序设计题程序1.界面设计参看图10-1、 10-2以及表10-1。

表10-1 实例2各控件的主要属性设置过程设计如下:Private sub Form_Click()Command2.Enabled = FalseEen SubPrivate Sub Command1_Click()Label2.Visible = FalseLabel1.Caption = Text1.Text + ": 欢迎使用" +资料内容仅供您学习参考,如有不当或者侵权,请联系改正或者删除。

Label1.CaptionText1.Visible = FalseCommand1.Enabled = False: Command2.Enabled = True End SubPrivate Sub Command2_Click()EndEnd Sub程序2.界面设计略, 过程设计如下:Private Sub Command1_Click() '字体变大 Form1.FontSize = Form1.FontSize + 3Form1.Cls: Print "欢迎使用VB"End SubPrivate Sub Command2_Click() '字体变小 Form1.FontSize = Form1.FontSize - 3Form1.Cls: Print "欢迎使用VB"End SubPrivate Sub Command3_Click() '字体加粗 Form1.FontBold = TrueForm1.Cls: Print "欢迎使用VB"End SubPrivate Sub Command4_Click() '字体不加粗 Form1.FontBold = FalseForm1.Cls: Print "欢迎使用VB"End Sub运行时, 不得连续、过多次单击”字体变小”按钮, 因为当FontSize属性值小于0会产生适时错误。

计算机base选择题+答案

计算机base选择题+答案

请注意:答案正确率在99%。

因此参考答案请慎重!!!"32位微机"是指它所用的CPU是______。

答案:A一次能处理32位二进制数"32位微型计算机"中的32指的是______。

答案:D机器字长"32位微型计算机"中的32指的是______。

答案:D计算机的字长"ASCII码",用来将字符转换为二进制数。

下列四种说法中不正确的是______。

答案:A 只有微型计算机使用ASCII码"ASCII码",用来将字符转换为二进制数。

下列四种说法中正确的是______。

答案:C "ASCII"的中文翻译是"美国标准信息交换代码""ASCII码"即"美国标准信息交换代码",用来将字符转换为二进制数。

下列四种说法正确的是______。

答案:B大多数的计算机使用ASCII码"ASCII码"即"美国标准信息交换代码",用来将字符转换为二进制数。

下列四种说法正确的是______。

答案:D大多数的计算机使用ASCII码"计算机能够进行逻辑判断,并根据逻辑运算的结果选择相应的处理。

",该描述说明计算机具有______。

答案:D逻辑判断能力"使用计算机进行数值运算,可根据需要获得千分之一到几百万分之一甚至更高的精确度。

",该描述说明计算机具有______。

答案:D很高的计算精度"现代计算机速度最高可达每秒千亿次运算,…",该描述说明计算机具有______。

答案:B高速运算的能力“计算机的发展进入了以计算机网络为特征的时代”是在______。

答案:D 第四代计算机的时代“计算机辅助设计”的英文缩写是______。

答案:C CAD“美国标准信息交换代码”即______。

SAS-Base认证考试—70题(01-10)

SAS-Base认证考试—70题(01-10)

SAS分多个认证种类:base,advanced,clinic等,但大多需要先通过base认证。

但凡这类商业组织提供的考证,基本都是题库型,所以想考过难度并不大。

对于只想拿SAS认证的人,如果熟练掌握网上流传甚广的sas真题70题,通过base认证基本就没问题。

•SAS Base认证考试题库—70题[完整答案版]Q 11. 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. GenderB. DepartmentC. Gender DepartmentD. Department Gender答案:A本题知识点:自动变量在SAS读取数据时,在PDV过程中会产生很多自动变量,在输出的数据集中是不可见的。

•FIRST.VARIABLE:同一个BY变量(组),若新的变量值第一次出现时,其first.variable值为1。

•LAST.VARIABLE:同一个BY变量(组),若新的变量值最后一次出现时,其last.variable值为1。

另外,在BY变量右面有多个变量时,先按第一个变量排序,若第一个变量的观测存在重复时,才按第二个变量排序。

Q 2Given the following raw data records in TEXTFILE.TXT:----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final 13 25 14 27 .2 John MAR Current 26 17 29 11 $233 Tina FEB Final 15 18 12 13 .4 Tina MAR Current 29 14 19 27 $20Which SAS program correctly produces the desired output?A. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dsd;input Name Month ;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;B. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',' missover;input Name Month ;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',';input Name Month @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dsd @;input Name Month ;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;答案:C本题知识点:INFILE语句与指示器@、@@INFILE filespecification options;其中,filespecification用来定义文件, options给出选择项;•filespecification有以下三种形式:①、fileref(文件标志)②、’filename’(文件名)③、CARDS指明输入的数据,紧跟着CARDS语句•下列选择项(options)可以出现在INFILE语句中:①、COLUMN=variable或COL=variable 定义一个变量, 其值是指针所在的当前列位置。

SAS base 50题 训练题(含答案及解析)

SAS base 50题  训练题(含答案及解析)

SAS 中文论坛网站1.A raw data file is listed below.1---+----10---+----20---+---son Frank 01/31/89daughter June 12-25-87brother Samuel 01/17/51The following program is submitted using this file as input:data work.family;infile 'file-specification';<insert INPUT statement here >run;Which INPUT statement correctly reads the values for the variable Birthdate as SAS date values?a. i nput relation $ first_name $ birthdate date9.;b.i nput relation $ first_name $ birthdate mmddyy8.; c.i nput relation $ first_name $ birthdate : date9.; d.i nput relation $ first_name $ birthdate : mmddyy8.; Correct answer: dAn informat is used to translate the calendar date to a SAS date value. The date values are in the form of two-digit values for month-day-year, so the MMDDYY8. informat must be used. When using an informat with list input, the colon-format modifier is required to correctly associate the informat with the variable name.You can learn about•informats in Reading Date and Time Values • the colon-format modifier in Reading Free-Format Data .2.A raw data file is listed below.1---+----10---+----20---+---Jose,47,210Sue,,108The following SAS program is submitted using the raw data file above as input: data employeestats;<insert INFILE statement here>input name $ age weight;run;The following output is desired:name age weight Jose 47 210 Sue . 108Which of the following INFILE statements completes the program and accesses the data correctly?a. infile 'file-specification ' pad;b. infile 'file-specification ' dsd;SAS 中文论坛网站c. infile 'file-specification ' dlm=',';d. infile 'file-specification ' missover;Correct answer: bThe PAD option specifies that SAS pad variable length records with blanks. TheMISSOVER option prevents SAS from reading past the end of the line when reading free formatted data. The DLM= option specifies the comma as the delimiter; however,consecutive delimiters are treated as one by default. The DSD option correctly reads the data with commas as delimiters and two consecutive commas indicating a missing value like those in this raw data file.You can learn about• the PAD option in Reading Raw Data in Fixed Fields•the MISSOVER option in Creating Multiple Observations from a SingleRecord• the DLM= option and the DSD option in Reading Free-Format Data . 3.The following program is submitted:data numrecords;infile cards dlm=',';input agent1 $ agent2 $ agent3 $;cards;jones,,brownjones,spencer,brown;run;What is the value for the variable named Agent2 in the second observation?a.brown b.spencer c.' ' (missing character value) d. There is no value because only one observation is created.Correct answer: dThe CARDS statement enables you to read instream data. Any number of consecutive commas are considered to be a single delimiter as a result of the DLM= option, and the length of each variable defaults to 8 bytes. Therefore, the values jones , brownjon , and spencer are assigned to Agent1, Agent2, and Agent3, respectively, for the firstobservation. The rest of the data on the record is not read by the INPUT statement and is not output to the data set.You can learn about•the CARDS statement in Creating SAS Data Sets from Raw Data • the default length of variables in Reading Free-Format Data .4.A raw data file is listed below.1---+----10---+----20---+----30---+----40---+----50TWOSTORY 1040 2 1SANDERS ROAD $55,850CONDO 2150 4 2.5JEANS AVENUE $127,150The following program is submitted using this file as input:data work.houses;infile 'file-specification';<insert INPUT statement here>run;Which one of the following INPUT statements reads the raw data file correctly?a.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street 16.@40 price dollar8;b.input @1 style $8+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street $16@40 price dollar8.;c.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street $16.@40 price dollar8.;d.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3street 16.@40 price dollar8.;Correct answer: cFormatted input requires periods as part of the informat name. The period is missing from the variables Style and Street in Answer b, the variable Baths in Answer d, and the variable Price in Answer a (which is also missing a dollar sign to read the variable Street as a character value).You can learn about formatted input and informats in Reading Raw Data in Fixed Fields.5. The following SAS program is submitted at the start of a new SAS session:libname sasdata 'SAS-data-library';data sasdata.sales;set sasdata.salesdata;profit=expenses-revenues;run;SAS中文论坛网站SAS 中文论坛网站proc print data=sales;run;The SAS data set Sasdata.Salesdata has ten observations. Which one of the following explains why a report fails to generate?a. The DATA step fails execution.b. The SAS data set Sales does not exist.c. The SAS data set Sales has no observations.d. The PRINT procedure contains a syntax error.Correct answer: bThe DATA step creates a permanent SAS data set, Sasdata.Salesdata . The PRINTprocedure is printing a temporary SAS data set, Sales , that is stored in the Work library. At the beginning of the SAS session, Work.Sales does not exist.You can learn about•creating permanent data sets with the DATA step in Creating SAS Data Setsfrom Raw Data• temporary data sets in Basic Concepts . 6. Which action assigns a reference named SALES to a permanent SAS data library? a. Issuing the command:libref SALES 'SAS-data-library'b. Issuing the command:libname SALES 'SAS-data-library'c.Submitting the statement: libref SALES 'SAS-data-library';d. Submitting the statement: libname SALES 'SAS-data-library';Correct answer: dThe LIBNAME statement assigns a reference known as a libref to a permanent SAS data library. The LIBNAME command opens the LIBNAME window.You can learn about the LIBNAME statement in Referencing Files and Setting Options .7. The following SAS program is submitted:data newstaff;set staff;<insert WHERE statement here>run;Which one of the following WHERE statements completes the program and selects only observations with a Hire_date of February 23, 2000?a. where hire_date='23feb2000'd;b. where hire_date='23feb2000';c. where hire_date='02/23/2000'd;d.where hire_date='02/23/2000';Correct answer: aA SAS date constant must take the form of one- or two-digit day, three-digit month, and two- or four-digit year, enclosed in quotation marks and followed by a d('ddmmmyy<yy>'d).You can learn about SAS date constants in Creating SAS Data Sets from Raw Data. 8. Which one of the following SAS date formats displays the SAS date value for January 16, 2002 in the form of 16/01/2002?a. DATE10.b. DDMMYY10.c. WEEKDATE10.d. DDMMYYYY10.Correct answer: bThe requested output is in day-month-year order and is 10 bytes long, so DDMMYY10. is the correct format. Although WEEKDATE10. is a valid SAS format, it does not display the SAS date value as shown in the question above. DDMMYYYY10. is not a valid SAS date format, and the DATE w. format cannot accept a length of 10.You can learn about•the DDMMYY10. format in Creating List Reports•the WEEKDATE10. format in Reading Date and Time Values.9. Which one of the following displays the contents of an external file from within a SAS session?a. the LIST procedureb.the PRINT procedurec.the FSLIST procedured.the VIEWTABLE windowCorrect answer: cThe PRINT procedure and VIEWTABLE window display the values in SAS data sets. The FSLIST procedure displays the values in external files. There is no LIST procedure in SAS.You can learn about•the PRINT procedure in Creating List ReportsSAS中文论坛网站SAS 中文论坛网站• the VIEWTABLE window in Referencing Files and Setting Options .10. The SAS data set Sashelp.Prdsale contains the variables Region and Salary with 4 observations per Region . Sashelp.Prdsale is sorted primarily by Region and within Region by Salary in descending order.The following program is submitted:data one;set sashelp.prdsale;retain temp;by region descending salary;if first.region thendo;temp=salary;output;end;if last.region thendo;range=salary-temp;output;end;run;For each region, what is the number of observation(s) written to the output data set? a. 0b. 1c. 2d. 4Correct answer: cThe expression first.region is true once for each region group. The expression last.region is true once for each region group. Therefore, each OUTPUT statement executes once for a total of 2 observations in the output data set.You can learn about the FIRST.variable expression and the OUTPUT statement in Reading SAS Data Sets .11. The following SAS program is submitted:proc contents data=sasuser.houses;run;The exhibit below contains partial output produced by the CONTENTS procedure. Data Set NameSASUSER.HOUSES Observations 15 Member TypeDATA Variables 6 EngineV9 Indexes 0 CreatedTuesday, April 22, 2003 03:09:25 PMObservation Length 56 Last ModifiedTuesday, April 22, 2003 03:09:25 PMDeleted Observations0 Protection CompressedNOData Set Type Sorted NOLabel Residential housingfor saleData Representation WINDOWS_32Encoding wlatin1 Western(Windows)Which of the following describes the Sasuser.Houses data set?a.The data set is sorted but not indexed.b.The data set is both sorted and indexed.c.The data set is not sorted but is indexed.d.The data set is neither sorted nor indexed.Correct answer: dThe exhibit above shows partial output from the CONTENTS procedure, In the top right-hand column of the output, you see that Indexes has a value of 0, which indicates that no indexes exist for this data set. Also, Sorted has a value of NO, which indicates that the data is not sorted.You can learn about the CONTENTS procedure in Referencing Files and Setting Options.12.The following SAS program is submitted:proc sort data=work.test;by fname descending salary;run;Which one of the following represents how the observations are sorted?a. The data set Work.Test is stored in ascending order by both Fname and Salary values.b. The data set Work.Test is stored in descending order by both Fname and Salary values.c. The data set Work.Test is stored in descending order by Fname and ascending order by Salary values.d. The data set Work.Test is stored in ascending order by Fname and in descending order by Salary values.Correct answer: dThe DESCENDING keyword is placed before the variable name it modifies in the BY statement, so the correct description is in descending order by Salary value within ascending Fname values.You can learn about the SORT procedure and the DESCENDING keyword in Creating List Reports.13.The following SAS program is submitted:data names;SAS中文论坛网站title='EDU';if title='EDU' thenDivision='Education';else if title='HR' thenDivision='Human Resources';else Division='Unknown';run;Which one of the following represents the value of the variable Division in the output data set?catiocationc.Human Red.Human ResourcesCorrect answer: bThe length of the variable Division is set to 9 when the DATA step compiles. Since the value of the variable Title is EDU, the first IF condition is true; therefore, the value of the variable Division is Education.You can learn about•the length of a variable in Understanding DATA Step Processing•IF-THEN statements in Creating and Managing Variables.14.Which one of the following SAS programs creates a variable named City with a value of Chicago?a.data work.airports;AirportCode='ord';if AirportCode='ORD' City='Chicago';run;b.data work.airports;AirportCode='ORD';if AirportCode='ORD' City='Chicago';run;c.data work.airports;AirportCode='ORD';if AirportCode='ORD' then City='Chicago';run;d.data work.airports;AirportCode='ORD';if AirportCode='ORD';then City='Chicago';run;Correct answer: cThe correct syntax for an IF-THEN statement is: IF expression THEN statement;In this example, the variable City is assigned a value of Chicago only if the expression AirportCode='ORD' is true.SAS中文论坛网站SAS 中文论坛网站You can learn about IF-THEN statements in Creating and Managing Variables .15.The following SAS program is submitted:data work.building;code='DAL523';code='SANFRAN604';code='HOUS731';length code $ 20;run;Which one of the following is the length of the code variable?a. 6b. 7c. 10d. 20Correct answer: aThe DATA step first goes through a compilation phase, then an execution phase. The length of a variable is set during the compilation phase and is based on the first time the variable is encountered. In this case, the variable code is set to the length of the text string DAL523 which is 6 characters long. The next assignment statements are ignored during compilation. The LENGTH statement is also ignored since the length has already been established, but a note will be written to the log.You can learn about•the compilation phase of the DATA step in Understanding DATA StepProcessing• the LENGTH statement in Creating and Managing Variables .16. Which of the following statements creates a numeric variable named IDnumber with a value of 4198?a. IDnumber=4198;b. IDnumber='4198';c. length IDnumber=8;d. length IDnumber $ 8;Correct answer: aThe first reference to the SAS variable in the DATA step sets the name, type, and length of the variable in the program data vector (PDV) and in the output SAS data set. The assignment statement IDnumber=4198; is the first reference and creates a numeric variable named IDnumber with a default storage length of 8 bytes.You can learn about• creating variables in the DATA step in Understanding DATA Step ProcessingSAS 中文论坛网站• numeric variables in Basic Concepts .17. The following program is submitted:data fltaten;input jobcode $ salary name $;cards;FLAT1 70000 BobFLAT2 60000 JoeFLAT3 30000 Ann;run;data desc;set fltaten;if salary>60000 then description='Over 60';else description='Under 60';run;What is value of the variable named description when the value for salary is 30000? a.Under 6 b.Under 60 c.Over 60 d. ' ' (missing character value)Correct answer: aThe variable description is being created by the IF-THEN/ELSE statement during compilation. The first occurrence of the variable description is on the IF statement, and since it is assigned the value Over 60, the length of the variable is 7. Therefore, for the salary value of 30000, description has the value of Under 6 (the 0 is truncated.) You can learn about•the compilation phase of the DATA step in Understanding DATA StepProcessing• IF-THEN/ELSE statements in Creating and Managing Variables .18. A raw data file is listed below.1---+----10---+----20---+---10232015The following program is submitted:data all_sales;infile 'file-specification';input receipts;<insert statement(s) here>run;SAS 中文论坛网站Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable?a. total+receipts;b.total 0; sum total;c. total=total+receipts;d. total=sum(total,receipts);Correct answer: aThe SUM function and the assignment statement do not retain values across iterations of the DATA step. The sum statement total+receipts; initializes total to 0, ignores missing values of receipt , retains the value of total from one iteration to the next, and adds the value of receipts to total .You can learn about the sum statement in Creating and Managing Variables .19.A raw data file is listed below.1---+----10---+----20---+---1901 21905 11910 61925 11941 1The following SAS program is submitted and references the raw data file above: data money;infile 'file-specification';input year quantity;total=total+quantity;run;What is the value of total when the data step finishes executing?a.0 b.1 c.11 d. . (missing numeric value)Correct answer: dThe variable Total is assigned a missing value during the compilation phase of the DATA step. When the first record is read in, SAS processes: total=.+2; which results in a missing value. Therefore the variable Total remains missing for all observations. You can learn about• the compilation phase of the DATA step in Understanding DATA StepProcessingSAS 中文论坛网站• using missing values with arithmetic operators in Creating SAS Data Sets fromRaw Data .20.The following program is submitted:data test;average=mean(6,4,.,2);run;What is the value of average ?a.0 b.3 c.4 d. . (missing numeric value)Correct answer: cThe MEAN function adds all of the non-missing values and divides by the number of non-missing values. In this case, 6 + 4 + 2 divided by 3 is 4.You can learn about the MEAN function in Transforming Data with SAS Functions .21.The following SAS program is submitted:data work.AreaCodes;Phonenumber=3125551212;Code='('!!substr(Phonenumber,1,3)!!')';run;Which one of the following is the value of the variable Code in the output data set? a. ( 3)b. (312)c. 3d. 312Correct answer: aAn automatic data conversion is performed whenever a numeric variable is used where SAS expects a character value. The numeric variable is written with the BEST12. format and the resulting character value is right-aligned when the conversion occurs. In this example, the value of Phonenumber is converted to character and right-aligned before the SUBSTR function is performed. Since there are only 10 digits in the value ofPhonenumber , the right-aligned value begins with two blanks. Therefore the SUBSTR function picks up two blanks and a 3, and uses the BEST12. format to assign that value to Code . Then, the parentheses are concatenated before and after the two blanks and a 3. You can learn about automatic data conversion and the SUBSTR function inTransforming Data with SAS Functions .22.The following SAS program is submitted:data work.inventory;products=7;SAS 中文论坛网站do until (products gt 6);products+1;end;run;Which one of the following is the value of the variable products in the output data set? a. 5b. 6c. 7d. 8Correct answer: dA DO UNTIL loop always executes at least once because the condition is not evaluated until the bottom of the loop. In the SAS program above, the value of Products isincremented from 7 to 8 on the first iteration of the DO UNTIL loop, before the condition is checked. Therefore the value of Products is 8.You can learn about DO UNTIL loops in Generating Data with DO Loops .23.The following program is submitted:data work.test;set work.staff (keep=salary1 salary2 salary3);<insert ARRAY statement here>run;Which ARRAY statement completes the program and creates new variables?a. array salary{3};b. array new_salary{3};c. array salary{3} salary1-salary3;d. array new_salary{3} salary1-salary3;Correct answer: bAlthough each of the ARRAY statements listed above is a valid statement, only AnswerB creates new variables named new_salary1, new_salary2 and new_salary3. AnswerC and AnswerD both create an array that groups the existing data set variables salary1, salary2, and salary3. Since the array in Answer A is named salary , it also uses the existing data set variables.You can learn about creating new variables in an ARRAY statement in Processing Variables with Arrays .24.Which of the following permanently associates a format with a variable?a. the FORMAT procedureb. a FORMAT statement in a DATA stepc. an INPUT function with format modifiersd. an INPUT statement with formatted style inputCorrect answer: bSAS 中文论坛网站To permanently associate a format with a variable, you use the FORMAT statement in a DATA step. You can use the FORMAT procedure to create a user-defined format. You use the INPUT function to convert character data values to numeric values with an informat. You use the INPUT statement to read data into a data set with an informat. You can learn about•permanently assigning a format to a variable in Creating and Managing Variables •the FORMAT statement in Creating List Reports •the FORMAT procedure in Creating and Applying User-Defined Formats •the INPUT function in Transforming Data with SAS Functions • the INPUT statement in Reading Raw Data in Fixed Fields .25.The following report is generated:Styleof homesn A skingPriceCONDO 4 $99,313RANCH 4 $68,575SPLIT3 $77,983 TWOSTORY4 $83,825Which of the following steps created the report?a. proc freq data=sasuser.houses;tables style price /nocum;format price dollar10.;label style="Style of homes"price="Asking price";run;b.proc print data=sasuser.houses; class style;var price;table style,n price*mean*f=dollar10.;label style="Style of homes"price="Asking price";run;c.proc means data=sasuser.houses n mean; class style;var price;format price dollar10.;label style="Style of homes"price="Asking price";run;d.proc report data=sasuser.houses nowd headline; column style n price;define style / group "Style of homes";define price / mean format=dollar8."Asking price";run;Correct answer: dThe FREQ procedure cannot create the average asking price. The CLASS statement and the VAR statement are not valid for use with the PRINT procedure. The MEANS procedure output would have both the N statistic and the N Obs statistic since a CLASS statement is used. The REPORT procedure produced the report.You can learn about•the FREQ procedure in Producing Descriptive Statistics•the PRINT procedure in Creating List Reports•the MEANS procedure in Producing Descriptive Statistics•the REPORT procedure in Creating Enhanced List and Summary Reports. 26.A SAS report currently flows over two pages because it is too long to fit within the specified display dimension. Which one of the following actions would change the display dimension so that the report fits on one page?a.Increase the value of the LINENO option.b.Decrease the value of the PAGENO option.c.Decrease the value of the LINESIZE option.d.Increase the value of the PAGESIZE option.Correct answer: dThe PAGESIZE= SAS system option controls the number of lines that compose a page of SAS procedure output. By increasing the number of lines available per page, the report might fit on one page.You can learn about the PAGESIZE= option in Referencing Files and Setting Options.27.Which one of the following SAS REPORT procedure options controls how column headings are displayed over multiple lines?a. SPACE=b. SPLIT=c. LABEL=d. BREAK=Correct answer: bThe SPLIT= option specifies how to split column headings. The SPACE=, LABEL= and BREAK= options are not valid options in PROC REPORT.You can learn about the SPLIT= option for the REPORT procedure in Creating Enhanced List and Summary Reports.SAS中文论坛网站28.The following SAS program is submitted:ods html file='newfile.html';proc print data=sasuser.houses;run;proc means data=sasuser.houses;run;proc freq data=sasuser.shoes;run;ods html close;proc print data=sasuser.shoes;run;How many HTML files are created?a. 1b. 2c. 3d. 4Correct answer: aBy default, one HTML file is created for each FILE= option or BODY= option in the ODS HTML statement. The ODS HTML CLOSE statement closes the open HTML file and ends the output capture. The Newfile.html file contains the output from the PRINT, MEANS, and FREQ procedures.You can learn about the ODS HTML statement in Producing HTML Output.29.A frequency report of the variable Jobcode in the Work.Actors data set is listed below.Jobcode Frequency Percent CumulativeFrequency CumulativePercentActor I233.33233.33Actor II233.33466.67Actor III233.336100.00Frequency Missing = 1The following SAS program is submitted:data work.joblevels;set work.actors;if jobcode in ('Actor I', 'Actor II') thenjoblevel='Beginner';if jobcode='Actor III' thenjoblevel='Advanced';else joblevel='Unknown';run;Which of the following represents the possible values for the variable joblevel in the Work.Joblevels data set?a.Advanced and Unknown onlySAS中文论坛网站SAS 中文论坛网站b. Beginner and Advanced onlyc. Beginner , Advanced , and Unknownd. ' ' (missing character value)Correct answer: aThe DATA step will continue to process those observations that satisfy the condition in the first IF statement Although Joblevel might be set to Beginner for one or more observations, the condition on the second IF statement will evaluate as false, and the ELSE statement will execute and overwrite the value of Joblevel as Unknown . You can learn about•the IF statement in Creating SAS Data Sets from Raw Data • the ELSE statement in Creating and Managing Variables .30.The descriptor and data portions of the Work.Salaries data set are shown below. Variable Type Len Posname Char 8 0salary Char 8 16status Char 8 8name status salary Liz S 15,600 Herman S 26,700 Marty S 35,000The following SAS program is submitted:proc print data=work.salaries;where salary<20000;run;What is displayed in the SAS log after the program is executed?a. A NOTE indicating that 1 observation is read.b. A NOTE indicating that 0 observations were read.c. A WARNING indicating that character values have been converted to numeric values.d. An ERROR indicating that the WHERE clause operator requires compatible variables. Correct answer: dSalary is defined as a character variable. Therefore, the value in the WHERE statement must be the character value 20,000 enclosed in quotation marks.You can learn about the WHERE statement in Creating List Reports .31.Which of the following statements is true when SAS encounters a syntax error in a DATA step?SAS 中文论坛网站a. The SAS log contains an explanation of the error.b. The DATA step continues to execute and the resulting data set is complete.c. The DATA step stops executing at the point of the error and the resulting data set contains observations up to that point.d. A note appears in the SAS log indicating that the incorrect statement was saved to a SAS data set for further examination.Correct answer: aSAS scans the DATA step for syntax errors during the compilation phase. If there are syntax errors, those errors get written to the log. Most syntax errors prevent further processing of the DATA step.You can learn about how SAS handles syntax errors in the DATA step in Understanding DATA Step Processing .32.Which TITLE statement would display JANE'S DOG as the text of the title?a. title "JANE"S DOG";b. title 'JANE"S DOG';c. title "JANE'S DOG";d. title 'JANE' ' 'S DOG';Correct answer: cThe title in a TITLE statement must be enclosed in a pair of matched quotation marks. Unbalanced quotation marks can cause problems for SAS. To hide an unmatched single quotation mark, surround the title text with matched double quotation marks.You can learn about•the TITLE statement in Creating List Reports • unbalanced quotation marks in Editing and Debugging SAS Programs .33.The following SAS program is submitted:data test;input animal1 $ animal2 $mlgrams1 mlgrams2;cards;hummingbird ostrich 54000.39 90800000.87;run;Which one of the following represents the values of each variable in the output data set?a. animal1 animal2 mlgrams1 mlgrams2 hummingb ostrich 54000.39 90800000b. animal1 animal2 mlgrams1 mlgrams2 hummingb ostrich 54000.39 90800000.87c. animal1 animal2 mlgrams1 mlgrams2 hummingbird ostrich 54000.39 90800000d. animal1 animal2 mlgrams1 mlgrams2。

SASBase认证考试(70真题 答案解析详解)

SASBase认证考试(70真题 答案解析详解)

SAS Base认证考试—70题SAS分多个认证种类:base,advanced,clinic等,但大多需要先通过base认证。

但凡这类商业组织提供的考证,基本都是题库型,所以想考过难度并不大。

对于只想拿SAS认证的人,如果熟练掌握网上流传甚广的sas真题70题,通过base认证基本就没问题。

Q 11. 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. GenderB. DepartmentC. Gender DepartmentD. Department Gender答案:A本题知识点:自动变量在SAS读取数据时,在PDV过程中会产生很多自动变量,在输出的数据集中是不可见的。

· FIRST.VARIABLE:同一个BY变量(组),若新的变量值第一次出现时,其first.variable值为1。

· LAST.VARIABLE:同一个BY变量(组),若新的变量值最后一次出现时,其last.variable值为1。

另外,在BY变量右面有多个变量时,先按第一个变量排序,若第一个变量的观测存在重复时,才按第二个变量排序。

Q 2Given the following raw data records in TEXTFILE.TXT:----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20Which SAS program correctly produces the desired output?A. data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;B. data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C. data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D. data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;答案:C本题知识点:INFILE语句与指示器@、@@INFILE filespecification options;其中,filespecification用来定义文件, options给出选择项;· filespecification有以下三种形式:①、fileref(文件标志)②、’filename’(文件名)③、CARDS指明输入的数据,紧跟着CARDS语句· 下列选择项(options)可以出现在INFILE语句中:①、COLUMN=variable或COL=variable 定义一个变量, 其值是指针所在的当前列位置。

sas base练习题

sas base练习题

sas base练习题SAS Base练习题SAS(Statistical Analysis System)是一种广泛使用的统计分析软件,它具有强大的数据处理和分析功能。

对于想要提升自己的数据分析能力的人来说,掌握SAS Base是必不可少的。

为了帮助大家更好地学习和掌握SAS Base,下面将介绍一些常见的练习题。

练习一:数据导入与清洗在实际的数据分析中,数据的导入和清洗是非常重要的步骤。

假设我们有一个包含学生信息的Excel表格,其中包括学生的姓名、年龄、性别、成绩等字段。

请使用SAS Base将该Excel表格导入到SAS数据集中,并进行数据清洗,例如删除重复数据、处理缺失值等。

练习二:数据统计与描述分析在数据分析过程中,我们经常需要对数据进行统计和描述分析。

假设我们有一个包含学生成绩的数据集,其中包括学生的姓名、科目、成绩等字段。

请使用SAS Base计算每个科目的平均成绩、最高成绩、最低成绩,并进行数据可视化,例如绘制柱状图、箱线图等。

练习三:数据合并与关联分析在实际的数据分析中,我们经常需要将多个数据集进行合并,并进行关联分析。

假设我们有两个数据集,一个包含学生的姓名、年龄等信息,另一个包含学生的成绩信息。

请使用SAS Base将这两个数据集按照学生姓名进行合并,并计算每个学生的平均成绩、总成绩等指标。

练习四:数据转换与格式化在数据分析过程中,我们经常需要对数据进行转换和格式化。

假设我们有一个包含学生的出生日期的数据集,其中日期的格式为YYYY-MM-DD。

请使用SAS Base将日期格式转换为YYYY年MM月DD日,并计算每个学生的年龄。

练习五:数据抽样与抽样分布在实际的数据分析中,我们经常需要对数据进行抽样,并进行抽样分布的分析。

假设我们有一个包含学生的成绩的数据集,其中包括学生的姓名、科目、成绩等字段。

请使用SAS Base对该数据集进行随机抽样,并计算抽样均值的抽样分布。

通过以上的练习题,我们可以更好地掌握SAS Base的基本操作和常用技巧。

SAS_base_考试必备_70真题(附答案)

SAS_base_考试必备_70真题(附答案)

1.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. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A-------------------------------------2.Given the following raw data records in TEXTFILE.TXT:----|----10---|----20---|----30John,FEB,13,25,14,27,FinalJohn,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20 Which SAS program correctly produces the desired output?A.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;B.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',' missover;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',';input Name $ Month $ @;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D.data WORK.NUMBERS;length Name $ 4 Month $ 3 Status $ 7;infile 'TEXTFILE.TXT' dsd @;input Name $ Month $;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;Answer: C-------------------------------------3.The Excel workbook REGIONS.XLS contains the following four worksheets:EASTWESTNORTHSOUTHThe 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;Answer: D-------------------------------------4.The following SAS program is submitted:data WORK.DATE_INFO;Day="01" ;Yr=1960 ;X=mdy(Day,01,Yr) ;run;What is the value of the variable X?A. the numeric value 0B. the character value "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.Answer: A-------------------------------------5.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;Answer: C-------------------------------------6.After 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;Answer: D-------------------------------------7.Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel?A. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXPAnswer: D-------------------------------------8.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.Answer: C-------------------------------------10.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.Answer: C 因为有一个$符号-------------------------------------11.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:Analysis Variable : HeightNSex Age Obs Minimum MaximumMean------------------------------------------------------------------F Pre-Teen 3 51.3 59.8 55.8Teen 6 56.5 66.5 63.0 M Pre-Teen 4 57.3 64.8 59.7 Teen 6 62.5 72.0 66.8 --------------------------------------------------------------------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;Answer: C-------------------------------------12.The Excel workbook QTR1.XLS contains the following three worksheets:JANFEBMARWhich 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);Answer: A-------------------------------------13.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 Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3Answer: A-------------------------------------14.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;Answer: c-------------------------------------15.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.Answer: D-------------------------------------16.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.Answer: B-------------------------------------17.Given the following data step:data WORK.GEO;infile datalines;input City $20.;if City='Tulsa' thenState='OK';Region='Central';if City='Los Angeles' thenState='CA';Region='Western';datalines;TulsaLos AngelesBangor;run;After data step execution, what will data set WORK.GEO contain?A.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangor WesternB.City State Region----------- ----- -------Tulsa OK WesternLos Angeles CA WesternBangorC.City State Region----------- ----- -------Tulsa OK CentralLos Angeles CA WesternBangor WesternD.City State Region----------- ----- -------Tulsa OK CentralLos CA WesternBangorAnswer: A-------------------------------------18.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.Answer: C-------------------------------------19.The SAS data set WORK.ONE contains a numeric variable named Num and a character variable named Char:WORK.ONENum Char--- ----1 233 231 77The following SAS program is submitted:proc print data=WORK.ONE;where Num='1';run;What is output?A.Num Char--- ----1 23B.Num Char--- ----1 231 77C.Num Char--- ----1 233 231 77D. No output is generated.Answer: D-------------------------------------20. 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.2C. Both LocalFee and CountryFee have a format of percent7.2D. The data step fails execution; there is no format for LocalFee.Answer: C-------------------------------------21.Given the SAS data set WORK.PRODUCTS:ProdId Price ProductType Sales Returns------ ----- ----------- ----- -------K12S 95.50 OUTDOOR 15 2B132S 2.99 CLOTHING 300 10R18KY2 51.99 EQUIPMENT 25 53KL8BY 6.39 OUTDOOR 125 15DY65DW 5.60 OUTDOOR 45 5DGTY23 34.55 EQUIPMENT 67 2The 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. 6Answer: B-------------------------------------22.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;Answer: c-------------------------------------23.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_";Answer: C-------------------------------------24.Given the following raw data records:----|----10---|----20---|----30Susan*12/29/1970*10Michael**6The following output is desired:Obs employee bdate years1 Susan 4015 102 Michael . 6Which 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;Answer: D-------------------------------------25.Given the following code:proc print data=SASHELP.CLASS(firstobs=5 obs=15);where Sex='M';run;How many observations will be displayed?A. 11B. 15C. 10 or fewerD. 11 or fewerAnswer: D-------------------------------------26.Which step sorts the observations of a permanent SAS data set by two variables and stores the sorted observations in a temporary SAS data set?A.proc sort out=EMPLOYEES data=EMPSORT;by Lname and Fname;run;B.proc sort data=SASUSER.EMPLOYEES out=EMPSORT;by Lname Fname;run;C.proc sort out=SASUSER.EMPLOYEES data=WORK.EMPSORT;by Lname Fname;run;D.proc sort data=SASUSER.EMPLOYEES out=SASUSER.EMPSORT;by Lname and Fname;run;Answer: B-------------------------------------27.Given the SAS data set WORK.TEMPS:Day Month Temp--- ----- ----1 May 7515 May 7015 June 803 June 762 July 8514 July 89The following program is submitted: proc sort data=WORK.TEMPS;by descending Month Day; run;proc print data=WORK.TEMPS; run;Which output is correct?A.Obs Day Month Temp --- --- ----- ----1 2 July 852 14 July 893 3 June 764 15 June 805 1 May 756 15 May 7B.Obs Day Month Temp --- --- ----- ----1 1 May 752 2 July 853 3 June 764 14 July 895 15 May 706 15 June 80C.Obs Day Month Temp --- --- ----- ----1 1 May 752 15 May 703 3 June 764 15 June 805 2 July 856 14 July 89D.Obs Day Month Temp--- --- ----- ----1 15 May 702 1 May 753 15 June 804 3 June 765 14 July 896 2 July 85Answer: C-------------------------------------28.Given the SAS data set WORK.P2000:Location Pop2000-------- -------Alaska 626931Delaware 783595Vermont 608826Wyoming 493782and the SAS data set WORK.P2008:State Pop2008-------- -------Alaska 686293Delaware 873092Wyoming 532668The following output is desired:Obs State Pop2000 Pop2008 Difference1 Alaska 626931 686293 593622 Delaware 783595 873092 894973 Wyoming 493782 532668 38886 Which SAS program correctly combines the data?A.data compare;merge WORK.P2000(in=_a Location=State)WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;B.data compare;merge WORK.P2000(rename=(Location=State))WORK.P2008;by State;if _a and _b;Difference=Pop2008-Pop2000;run;C.data compare;merge WORK.P2000(in=_a rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;D.data compare;merge WORK.P2000(in=_a) (rename=(Location=State)) WORK.P2008(in=_b);by State;if _a and _b;Difference=Pop2008-Pop2000;run;Answer: C-------------------------------------29.The following SAS program is sumbitted:data ;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. 1B. 2C. 3D. 4Answer: A-------------------------------------30.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: ----+----1----+----2----+----3----+----4----+----5--4 120104 F 46#30 11MAY1954 33Employee_Id=120104 employee_gender=F Salary=. birth_date=-2061 _ERROR_=1 _N_=4NOTE: 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------------------------------------------------------------------31. Given the following raw data records in DATAFILE.TXT:----|----10---|----20---|----30Kim,Basketball,Golf,TennisBill,FootballTracy,Soccer,TrackThe following program is submitted:data WORK.SPORTS_INFO;length Fname Sport1-Sport3 $ 10;infile 'DATAFILE.TXT' dlm=',';input Fname $ Sport1 $ Sport2 $ Sport3 $;run;proc print data=WORK.SPORTS_INFO;run;Which output is correct based on the submitted program?A.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football3 Tracy Soccer TrackB.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Football Football3 Tracy Soccer Track TrackC.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill Football Tracy SoccerD.Obs Fname Sport1 Sport2 Sport31 Kim Basketball Golf Tennis2 Bill FootballAnswer: C------------------------------------------------------------------32.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------------------------------------------------------------------33.The following SAS program is submitted:data WORK.TEST;set WORK.PILOTS;if Jobcode='Pilot2' then Description='Senior Pilot';else Description='Unknown';run;The value for the variable Jobcode is: PILOT2.What is the value of the variable Description?A. PILOT2B. UnknownC. Senior PilotD. ' ' (missing character value)Answer: B------------------------------------------------------------------34.A user-defined format has been created using the FORMAT procedure.How is it stored?A. in a SAS catalogB. in a memory resident lookup tableC. in a SAS dataset in the WORK libraryD. in a SAS dataset in a permanent SAS data libraryAnswer: AThese formats must be stored in the WORK.FORMATS or SASUSER.FORMATS catalog------------------------------------------------------------------35.given the SAS data set SASDATA.TWO:X Y-- --5 23 15 6The following SAS program is submitted:data SASUSER.ONE SASUSER.TWO OTHER;set SASDATA.TWO;if X eq 5 then output SASUSER.ONE;if Y lt 5 then output SASUSER.TWO;output;run;What is the result?A.data set SASUSER.ONE has 5 observationsdata set SASUSER.TWO has 5 observationsdata set WORK.OTHER has 3 observationsB.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 1 observationsC.data set SASUSER.ONE has 2 observationsdata set SASUSER.TWO has 2 observationsdata set WORK.OTHER has 5 observationsD. No data sets are output. The DATA step fails execution due to syntax errors. Answer: A------------------------------------------------------------------36.Given the contents of the raw data file 'EMPLOYEE.TXT':----+----10---+----20---+----30--Xing 2 19 2004 ACCTBob 5 22 2004 MKTGJorge 3 14 2004 EDUCThe following SAS program is submitted:data WORK.EMPLOYEE;infile 'EMPLOYEE.TXT';input@1 FirstName $@15 StartDate@25 Department $;run;Which SAS informat correctly completes the program?A. date9.B. mmddyy10.C. ddmmyy10.D. mondayyr10.Answer: B-------------------------------------------------------------37.The SAS data set Fed.Banks contains a variable Open_Date which hasbeen 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------------------------------------------------------------------ 38.Given the SAS data set WORK.ONE:X Y Z- - --1 A 271 A 331 B 452 A 522 B 693 B 704 A 824 C 91The following SAS program is submitted:data WORK.TWO;set WORK.ONE;by X Y;if First.Y;run;proc print data=WORK.TWO noobs;run;Which report is produced?A.X Y Z-- -- --1 B 452 A 522 B 693 B 704 A 824 C 91B.X Y Z-- -- --1 A 271 B 452 A 522 B 693 B 704 A 824 C 91C.X Y Z-- -- --1 A 331 B 452 A 522 B 693 B 704 A 824 C 91D. The PRINT procedure fails because the data set WORK.TWO is not created in the DATA step.Answer: B------------------------------------------------------------------39.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. HemingwayB. HemingwaC. ' ' (a missing value)D. The program contains errors. No variables are created.Answer: B------------------------------------------------------------------40.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. 6B. 7C. 8D. . (missing numeric)Answer: B------------------------------------------------------------------41.Given the raw data record in the file phone.txt:----|----10---|----20---|----30---|Stevens James SALES 304-923-3721 14The 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------------------------------------------------------------------42.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. 0B. 1C. 2D. 12Answer: D------------------------------------------------------------------43.Given the SAS data set WORK.ORDERS:WORK.ORDERSorder_id customer shipped-------- ------------ ---------9341 Josh Martin 02FEB20099874 Rachel Lords 14MAR200910233 Takashi Sato 07JUL2009The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value, and is shown with the DATE9. format.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,'shippedon',input(shipped,date9.),'to',customer);B. ship_note=catx(' ','Order',order_id,'shippedon',char(shipped,date9.),'to',customer);C. ship_note=catx(' ','Order',order_id,'shippedon',transwrd(shipped,date9.),'to',customer);D. ship_note=catx(' ','Order',order_id,'shippedon',put(shipped,date9.),'to',customer);Answer: D------------------------------------------------------------------44.The following SAS program is submitted:data ONE TWO SASUSER.TWOset 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 createdB. 3 temporary and 2 permanent SAS data sets are createdC. 2 temporary and 2 permanent SAS data sets are createdD. there is an error and no new data sets are createdAnswer: D------------------------------------------------------------------45.The following SAS program is submitted:ods csvall file='c:\test.cvs';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.cvs that can only be opened in Excel.B. A text file named test.cvs that can be opened in Excel or in any text editor.C. A text file named test.cvs that can only be opened in a text editor.D. A file named test.cvs that can only be opened by SAS.Answer: B------------------------------------------------------------------46.Given the SAS data set WORK.ONE:Obs Revenue2008 Revenue2009 Revenue2010--- ----------- ----------- -----------1 1.2 1.6 2.0The following SAS program is submitted:。

SAS BASE 题库

SAS BASE 题库

1.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. GenderB. DepartmentC. Gender DepartmentD. Department GenderAnswer: A本题考察的是:first.var和last.var这两个知识点。

本题的意思,数据集SALAR已经按照department 和gender排序,现在计算每一个department下每一个gender的某一个变量值的累积和。

根据本题的意思,写了一个模拟程序:data crackman;input department $ gender $ salary@;datalines;market f 6000market m 5000market f 5500market m 8000market f 6000market m 7000sales f 6000seles m 4000sales f 6000seles m 4000sales f 6000seles m 4000;proc sort data=crackman;by department gender;run;data result;set crackman;/*1*/by department gender;if first.gender then subtotal=salary;/*2*/else subtotal+salary;/*3*/if last.gender;/*4*/run;/*5*/这个DATA RESULT 部分程序执行的过程是这样(不是编译过程):/*我把执行的语句分为标记1 2 3 4 5*/1.1–2–4–1(先读数据—判断first.gender是否为1,第一个肯定是1——所以直接跳过else到if last.gender,last.gender=0所以—set crackman,继续读数据)2.1–2–3–4–13.1–2–3–4–5–1(因为是第三个了,所以last.gender=1 然后到run,输出到result.后面都是一样。

【格式】SASBase认证考试70题6170

【格式】SASBase认证考试70题6170

【关键字】格式Q 61Consider 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;run;Which statement produces a functionally equivalent result for assigning Group a value?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本题知识点:IF语句、IN的使用参照第17题。

Q 62The following SAS program is submitted:<_insert_ods_code_>proc means data=SASUSER.SHOES;where Product in ('Sandal' , 'Slipper' , 'Boot');run;<_insert_ods_code_>Which ODS statements, inserted in the two locations above, create a report stored in an html file?A. ods html open='sales.html';ods html close;B. ods file='sales.html' / html;ods file close;C. ods html file='sales.html';ods html close;D. ods file html='sales.html';ods file close;答案:C本题知识点:PROC COTENTS过程ODS的主要输出目标:LISTING、RESULTS、OUTPUT、HTML、CSV ALL、RTF、PDF、其他。

access_base选择题

access_base选择题

1、下面叙述正确的是____C__。

A、算法的执行效率与数据的存储结构无关B、算法的空间复杂度是指算法程序中指令(或语句)的条数C、算法的有穷性是指算法必须能在执行有限个步骤之后终止D、以上三种描述都不对2、以下数据结构中不属于线性数据结构的是__C____。

A、队列B、线性表C、二叉树D、栈3、在一棵二叉树上第5层的结点数最多是__B____。

A、8B、16C、32D、154、下面描述中,符合结构化程序设计风格的是__A____。

A、使用顺序、选择和重复(循环)三种基本控制结构表示程序的控制逻辑B、模块只有一个入口,可以有多个出口C、注重提高程序的执行效率D、不使用goto语句5、下面概念中,不属于面向对象方法的是___D___。

A、对象B、继承C、类D、过程调用6、在结构化方法中,用数据流程图(DFD)作为描述工具的软件开发阶段是__B____。

A、可行性分析B、需求分析C、详细设计D、程序编码7、在软件开发中,下面任务不属于设计阶段的是_D_____。

A、数据结构设计B、给出系统模块结构C、定义模块算法D、定义需求并建立系统模型8、数据库系统的核心是___B___。

A、数据模型B、数据库管理系统C、软件工具D、数据库9、下列叙述中正确的是___C___。

A、数据库是一个独立的系统,不需要操作系统的支持B、数据库设计是指设计数据库管理系统C、数据库技术的根本目标是要解决数据共享的问题D、数据库系统中,数据的物理结构必须与逻辑结构一致10、下列模式中,能够给出数据库物理存储结构与物理存取方法的是__A____。

A、内模式B、外模式C、概念模式D、逻辑模式11、算法的时间复杂度是指__C____。

A、执行算法程序所需要的时间B、算法程序的长度C、算法执行过程中所需要的基本运算次数D、算法程序中的指令条数12、下列叙述中正确的是___A___。

A、线性表是线性结构B、栈与队列是非线性结构C、线性链表是非线性结构D、二叉树是线性结构13、设一棵完全二叉树共有699个结点,则在该二叉树中的叶子结点数为_B_____。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
406设置用户权限时欲限定某业务员在录入订单时无权输入已交数量,因在哪处设置基本权限组权限基础数据权限扩展权限
407录入单据作业中的 符号,其意义为何?查询修改开窗查询相关信息作废
308录入单据作业中希望金额字段使用千分位分隔(,)应在何处设置录入程序编号录入用户权限每支录入单据作业的选项中设置设置自定义画面
录入程序编号录入数据表录入子系统信息录入多公司信息
203若本公司有新增栏位EX:COPXA->XA001特殊配件档,必须先至何处创建?
录入程序编号录入数据表录入子系统信息录入多公司信息
204若使用者为“仓管人员”,只须知道“数量”即可,则可在权限设置中将基本权限的成本及售价改为一般隐藏只读
305设置用户权限时欲限定某业务员在录入订单时只能看到分配给他自己的客户信息,因在哪处设置基本权限组权限基础数据权限扩展权限
X06修改报表格式,同一栏信息有二信息,欲拆成二栏显示,则下面栏位的“折行”选项应设“是”。
O07易飞所有可审核的作业都提供整批审核和整批撤销审核的功能。
X08在工作日志管理界面中提供“记录新增”、“记录修改”、“记录删除”三个选项,来实现合理记录工作日志,同时节约硬件资源
O09建档类作业保存后是停留在当前单据还是跳入新增界面以供连续录入可由每一个使用者自行设定
易飞ERP基础操作课后测验
讲师:日期:/ /
客户名称
学员姓名
分数
等级
1、是非题(50﹪)
X01易飞支持语言别为“简体中文”和“繁体中文”。
O02录入用户权限中“超级使用者”是指所有作业皆可执行。
O03录入单据作业中的 符号,其意义表示审核。
O04报表中若信息为数字,则可依使用者自定义小数位数。
O05 此符号的意义表示线上查询可按[F1]或以鼠标点选执行。
309若想将自己的工作流程与ERP作业做连接,可在何处做个性化设计作业菜单编辑器业务导航编辑器设计自定义画面检视类别
110当前活动控件是单头浏览或单身表格时,可通过哪组热键调出查找窗口,在表格中执行快速查找?Ctrl+FAlt+FShift+F
O10报表存放在报表数据库中日积月累造成系统运行的困扰,可通过“清除历史报表”作业处理报表不断累积的问题
二、选择题(单选)(50﹪)
301欲得知会计总账子系统的“系统代号”(ACT)可至何作业查询?
录入程序编号录入数据表录入子系统信息录入多公司信息
102若本公司有新增的个案程序EX:COPAR01 [客户地址名条打印],必须先至何处创建?
相关文档
最新文档