SAS Base Dumps

March 23, 2018 | Author: Mahesh Kumar Joshi | Category: Sas (Software), C (Programming Language), Data Set, Variable (Computer Science), String (Computer Science)


Comments



Description

Sample SAS certification Questions(Questions asked in Base SAS certification exam) Values and names may be different: 1.) Which ODS command closes the HTML file?? Answer: ODS HTML CLOSE; 2.) Which is the correct statement: a.) ODS HTML FILE = ‘file’; b.) ODS FILE HTML = ‘file’ c.) ODS FILE = ‘file’ d.) ODS HTML = ‘file’ Answer: a 3.) data temp; set lib1.x lib2.y; length jobcode $12.; run; What would be the length of Jobcode in temp? a.) b.) c.) d.) Answer: c 4.) PROC SORT data = lib.temp out = temp2; By subjid; Run; In which library temp2 is made? a.) b.) c.) d.) WORK SASUSER LIB SYNTAX ERROR 5 8 12 Syntax Error Answer: a 5.) options obs = 500; Data TEMP; Set test(firstobs = 75); Run; What will be the number of observations in temp dataset? a.) 424 b.) 425 c.) 500 d.) 75 e.) 426 Answer : e 1 6.) PROC SORT data = temp; BY Descending JOBCODE SALARY; RUN; Temp DATASET JOBCODE X1 X2 X2 A1 A2 A2 What will be the output?? Answer: SALARY 100 100 200 100 200 200 AGE 20 10 20 10 10 40 Temp DATASET JOBCODE X2 X2 X1 A2 A2 A1 SALARY 100 200 100 200 200 100 AGE 10 20 20 10 40 10 7.) PROC SORT DATA = TEMP; By Jobcode DESCENDING Salary; RUN; What will be the first observation? (Apply this on dataset created in last question) Answer: Temp DATASET JOBCODE A1 A2 A2 X1 X2 X2 8.) DATA TEMP; MERGE X1 X2; BY ID; RUN; SALARY 100 200 200 100 200 100 AGE 10 10 40 20 20 10 2 How many observations and variables will be there in temp dataset? X1 DATASET ID 1 2 NAME ANKUR VIJAY X2 DATASET ID 1 1 2 2 CLASS A B B A Answer: 3 variables and 4 observations 9.) DATA TEMP; MISSING CODE RUN; What is the correct missing code? a.) Merge Test1 /*Test1 contains JOBCODE */ Test2(rename = (Jcode = JOBCODE)); b.) Merge Test1 /*Test1 contains JOBCODE */ Test2(rename = (JOBCODE = JCODE)); c.) Merge Test1 (rename = (Jcode = JOBCODE)) /*Test1 contains JOBCODE */ Test2; d.) Merge Test1 /*Test1 contains JOBCODE */ Test2(rename Jcode = JOBCODE)); Answer: a 10.) data temp; test = ‘X’; select(test); when(‘Y’) Name = ‘Ank’; when(‘X’) Name = ‘Ankur’; when(‘Z’) Name = ‘ ’; end; run; What is the output? a.) Ankur b.) Ank c.) Missing (character missing value) d.) ‘Ankur’ Answer: Good Question. I would suggest you to try this question on your system. The answer is b. Its because during compilation time the length of variable Name is set as 3 (see the first case ‘Y’) and hence even if the case ‘X’ is satisfied the output will still be Ank. 11.) data _null_; put ‘ankur’; run; Where will the ouput(ankur) be written? a.) In Last file opened 3 ) They are temporary variables created in datastep. 16.) 13/03/2000 d. d. Hence I had to calculate the number of days from 01 Jan 1960.) 14682(number of days from 1st jan 1960) 4 . What is stored in x? a.) Will have values “YES” or “NO” d.) They are output in dataset.) Log Answer: d 12.) Corresponds to days from 01 Jan 1960: 135680 Answer: b (the choices mentioned in b and c points both were there. 17..) SECOND Answer: c 15. Answer: b 14. What will be stored in date? a. c.) 1----5----10--(data in file ‘asa’) 03132000 data temp. input date : MMDDYY10. b.) Can contain numeric and character values at same time.) PROC Report question on difference between display and across.) 02FEB2000 c.) DATA TEMP.) 01022000 b.) PROC Report question on difference between group and order.) 13MAR2000 b. There was a digit difference between 2 options) 18.) DATETIME b. infile ‘asa’.) Cannot be used in assignment statement.) Syntax error d.  Although a rough idea will do.) In dataset _null_ c. run.) This variable appears in output dataset c. X= ‘13MAR2000’d.) Will have values “TRUE” or “FALSE” Answer: a 13.) Can be used in assignments/calculation in datastep.) DATE d.) What is true about array variables? a.b.) What is the system option to print TIME in OUTPUT window? a. RUN.) TIME c. b.) Corresponds to days from 01 Jan 1960: 14682 c.) What is true about _ERROR_ variable? a. ) GOOD QUESTION Proc Format. 2000 c. March 13. March 13.) Mon. Data test. What will be the output of dataset test? a.) data test. Whenever SAS does not find a mapping for some value in the format it print the value as it is.) systax error Answer: d ( I would suggest please try it on your PC and check for different values. do while(n lt 6). Value ag 1-50 = ‘less’ 51-100 = ‘greater’.) data test..) 20.) data temp. What will be the value of n at the end of datastep? a.5. dat = ‘13MAR2000’d.) 21. Actually it comes out of do while loop when n is 6 and will not execute the statement n+1.) 02 January Answer: c (Note: the date is stored in dataset as SAS date) 19. set x.d.) 8 Answer: c (Good Question again. Run. n+1. n=1. 5 . What will be the value of dat in output dataset? a. format dat WEEKDATE.)14682 (nmber of days from 1st jan 1960) Answer: b 22. run.. X = 50. Format x ag.) 50.) ‘greater’ c.) ‘great’ d. run. end.) ‘less’ b. This question will tell you that before marking any choice think twice. Run.) 13MAR2000 b.) 5 c.) 6 d. “missing code” data test. 2000 d.) 7 b.5 e.) Monday. run. d.) FILE ‘filename’ dsd = ‘.) 4 Answer: b (note only one execution not complete dataset) 24. Input FNAME $ LNAME $ AGE.) syntax error Answer: b 26. Infile ‘filename’. c. What will be the missing code to reset the page number ? a.) OPTIONS RESET PAGENO = 1.) data temp.20 RAJU. Answer: c 25.SHARMA.) FILE ‘filename’ csv = ‘. else ID = ‘VIJAY’ then input R $2 @. /* 5 observations*/ if a and b. set test1(in = a) /* 2 observations*/ test2(in=b).’. c.. How many lines are read from input file during one execution of dataset? a.) 1 c.) FILE ‘filename’ dlm = ‘.) How to write comma separated file? a. Answer: a 23.) blank character value c.) 1----5----10----15----(file ‘abc’) RAM.) ‘.set y.. Input ID $5 @.) DATA TEMP.’. What will be the value of LNAME for 1st observation? a. d. 6 .’ b. If ID = ‘RAMES’ then input Y $6 Z $10 @. b.) OPTIONS PAGENO = 1. RUN. Input age 5. RUN.’.24 DATA temp. Infile ‘abc’ dsd.) OPTIONS RESET PAGENUMBER = 1.) 2 b.) FILE ‘filename’ dlm = ‘ ’ dsd = ‘.) ‘SHARMA’ d.’.) OPTIONS PAGENUMBER = 1. run.) 3 d. b. ) Why PROC FSLIST is used? a.) Question on PROC PRINT with BY statement. if first. /* 100 observations 20 for each ID*/ by ID.) What is the output of DATE9.ID then name = ‘RAJU’. data temp. run.) 5 c. How many observations will be present in temp dataset? a. Answer: d 30.as’.) libname temp ‘abc.) In datastep input is read from permanent location and output is written to permanent location.) 20 c. run.) to write to an external file b. else if ID = ‘RAM’ then name = ‘RAMU’. 29.) In datastep input is read from temporary location and output is written to temporary location. d.) 31NOV2000 e.) 31/11/2000 c. Which is the correct statement?? a.run.) In datastep input is read from temporary location and output is written to permanent location.) In datastep input is read from permanent location and output is written to temporary location.) to sort by date d. set sasuser.) 2 b. set test. repeated many times.) 5 b.) 7 d.) 0 Answer: a 28. How many observations will be there in temp dataset? a. format? a.) 0 Answer: 0 (Good question. Note a and b).ID.) to read from an external file c.)11/31/2000 b. c.) 01NOVEMBER2000 Answer: c 31.) not a valid statement 7 .sds. b.X1.) 100 d.) data temp.X2. 27. if last. 2. by ID. What will be the number of observations and variables in output dataset?? a.3.) LA = name||’ . b.) 1 and 4 d. do X=1 to 3 . What is the missing code to write ‘ankur.) 3 and 1 Answer: c 35) What informat should be used to read the date variable in the flat file having the values like 02NOV2003? a)DATE9. b)MMDDYY8.) D. keep = ID NAME.)).’||put(Age. e. merge test1(keep = ID) test2(keep = ID NAME CLASS AGE).) C.’||put(Age. c.) LA = TRIM(name)||’. a. input ID NAME $ AGE.2.22’ to variable LA.) Answer: b ID NAME NAME ID ID NAME CLASS AGE Syntax error 34. Answer: a 33.) 3 and 3 b.2. run.) LA = put(name)||’.) B. datalines. input name $1-10 age 15-16.) LA = name||’.’||put(Age.) data temp. 8 .) 1----5----10----15----20 (filename = ‘abc’) ankur 22 data temp.) 1 and 3 c.). Variables in output dataset? A.) data a.’||TRIM(put(Age. end. infile ‘file’.). 01 vivek 22 02 vital 25 03 rajes 20 .). /*missing code*/ run.Answer: b 32. What would be the attributes of variable Y in the dataset TEMP? a) Length of Y is $10. input date mmddyy10. run. the number of days from jan 1st . Please keep in mind that if there is any data error.mmddyy10. data temp. then there will be ‘. 1960 c) 1460000. But if we specify the informat like SALARY 5. 37) Flat file structure is as below 1----5----10 02032000 The following code is submitted.’ For numeric variables and blank for the character variables). y=put(x. run.120 b) 2 c). run..). SAS never stops execution when data error occurs.e ‘. the number of days from jan 1st .’ In the SALARY variable. x=14643. (period) d) Blank value Ans: b Tip: Here the SAS goes to the 5th column and read the value. b)Length of Y is 10 9 . input salary 5. what is the value of date in the dataset TEMP? a)02032000 b) 14643.120 The following code is submitted. infile ‘file specification’. data temp. 1960 d) 02/03/2000 Ans: b 38) The following code is submitted data temp.c)MMDDYY10. infile ‘file specification’. What would be the value of SALARY in the dataset TEMP? a)$1. SAS produces blank values to those variables(i. d) none Answer: a 36) Flat file structure is as below 1----5----10 $1. length y $5. x=4. data temp. what would be the value of variable AGE in the dataset TEMP when variable X has the value ‘Sue’? a) 30 b) 44 c) 40 d) 55 Ans: c 41) Flat file structure is as below (Very good question) 1----5----10 vital reddy 45 vijay 30 sarma 40 The following code is submitted. x=7. infile ‘file specification’. run. 10 . input x $ 1-3. else if x=7 then y='seven'.c) Length of Y is 8 d)None Ans: a 39) The following code is submitted data temp. if x='sue' then input age 5-6. else input height 8-9. run. if x=4 then y='four'. What would be the value of X and Y in the dataset temp? a) b) c) d) X=4 and Y= ‘seven’ X=7 and Y=’seven’ X=7 and Y=’four’ X=4 and Y=’four’ Ans: c 40) Flat file structure is as below 1----5----10 dan 23 45 bob 44 50 sue 30 80 mam 40 50 The following code is submitted. which of the below code changes the label of the variable SALARY to ‘given’? a) proc print data=temp label. 11 .data temp. salary='20000'. then salary=100. run. How many observations will be there in the TEMP dataset? a)3 b)2 c)zero observations d)syntax error Ans: a 42) The following code is submitted. infile ‘file specification’. total=sum(salary. salary=. if age<=40.(period) d)blank Ans: b 43) The following code is submitted. input x $ age. label salary='given'. run.bonus). run. data temp. salary=. What would be the value of BONUS variable in the dataset TEMP? a)’2000’ b)2000 c). data temp.(period) Ans: c 44) The descriptor portion of the dataset TEMP has the label of variable SALARY as ‘Actual salary’..1*salary. What would be the value of TOTAL variable in the dataset TEMP? a)100 b)110 c)10 d). run. bonus=0. if salary=.. bonus=10. if 100 le x le 200 then do. else description='unknown'. label salary='given'. d) proc print data=temp. 12 . label salary 'given'. z=300. run. What is the value of DESCRIPTION variable in the TEMP dataset? a) senior chemist b) unknown c) senior d) blank characters Ans: b Tip: here we need to use UPCASE (jobcode) in if statement as the character comparison is case sensitive.b) proc print data=temp label. Y. set temp. end. run. run. a) data temp. y='less than 200 and gt 100'. if jobcode='CHEM3' then description='senior chemist'. 46) The TEMP dataset has the values of variables as below X Y Z 150 less than 200 and gt 100 300 which of the below code creates the dataset TEMP with above values in the variables X. x=150. Ans: a 45) the dataset XYZ is as below JOBCODE Chem3 data xyz. and Z. c) proc print data=temp. run. label salary 'given'. else do. z=300. x=150. z=300. y='other values'. d) None Ans: a 47) Flat file structure is as below 1----5----10 23 44 The following code is submitted. if 100 le x le 200 then y='less than 200 and gt 100'. What is the value of HEIGHT variable in the TEMP dataset? a) . if 100 le x le 200 then do. data temp. run. else do. end. z=400. end. x=150. infile ‘file specification’. (period) b) Blank c) 44 d) 23 48) Following code is submitted. @4 height 2.y='other values'. run. else do. z=400. salary=salary+300. run. c) data temp. 13 . do j=1 to 4.. run. end. end. input @1 weight 2. data temp: do i=1 to 3. z=400. y='less than 200 and gt 100'. b) data temp. y='other values'. MYDATA. a) MEAN(var1-var4) b) MEAN(of var1-var4) c) MEAN(var1 var2 var3 var4) d) MEAN(var1) Ans: b 51) Which of the following code creates the permanent dataset MYDATA from temporary dataset MYDATA? Libname out ‘sas-library’.end. options obs=500. How many observations processed in each procedure? a) 401 in the proc print and 4501 in the proc means b) 5000 in the proc print and 500 in the proc means c) 500 in the proc print and 5000 in the proc means d) 4501 in the proc print and 401 in the proc means Ans: a 50) Which of the following code calculates the mean of variables var1. var3. set out. d) none 14 . var2. b) data MYDATA. how many observations will present in the dataset TEMP? a)1 b)3 c)2 d)0 Ans: a 49) The dataset XYZ has 5000 observations. and var4. c) data out.MYDATA. proc means data=xyz(firstobs=500) run. a) data MYDATA. run. run. run. set MYDATA. run. proc print data=xyz(firstobs=100 ) run. options obs=max. set MYDATA. what would be the length of the variable JOBCODE in the dataset TEMP2? a) b) c) d) 5 7 we can’t see the length as data set won’t be created due to errors.. run. will be taken from the first dataset that has occurred in the SET statement.lib(reddy)’.reddy.saslib’ data temp. what should be inserted in place of missing code? a)rawdata2 b)rawdata1 c)file d)none Ans: b 53) what is the procedure to print the data portion of the dataset? a)PROC MEANS b)PROC SQL c)PROC PRINT d)PROC CONTENTS Ans: c 54) what is the procedure to see the descriptor portion of the dataset? a)PROC MEANS b)PROC SQL c)PROC PRINT d)PROC CONTENTS Ans: d 55) The variable JOBCODE has length $5 in the dataset TEMP. infile missing code. None Ans: a Tip: whenever we are concatenating the datasets which are having the same variable names but having the difference in the attributes like Label. The same variable present in the dataset TEMP1 and has length $7. 15 .Ans: c 52) See the code below filename rawdata1 ‘u3x2888. set temp temp1. run.reddy. libname rawdata2 ‘u3x2888. data temp2. input x y. Here it is TEMP dataset. length etc. mmddyy10. a) b) c) d) 13JAN1960. Temp = qtr(input(Date.). Set a. LEN=SCAN(A. If Temp LE 3.56) one question on using same variable in the ID and BY statement of PROC PRINT. RUN. Date_________________________________________________ 01/01/2004 02/01/2004 03/02/2004 04/01/2004 05/01/2004 06/01/2004 07/01/2004 08/01/2004 09/01/2004 10/01/2004 11/01/2004 12/01/2004 How many observations will be there dataset b if the following datastep is submitted? Data b. 16 . Run. a=month(today()). Data _NULL_.)).3). 57) What will be the value of variable b in the log when following datastep is submitted? Today’s date is 31DEC2004. run. put b. b=put(a. James Bond’. A = ‘I am Bond. A) B) C) D) 3 5 9 6 Ans: D 59) What will be the length of variable LEN when the following code is submitted? Data temp. syntax error 31DEC2004 12 Ans:a 58) Data a has 12 observations and one variable Date as following.date9. run.4).a) b) c) d) 4 20 8 200 Ans: d 60) What will be the value of variable LEN when the following code is submitted? Date temp. A real Bond’. 17 . 61) How many observations will be there in output dataset temp? data temp. LEN=SUBSTR(A. Its length is same as the source string no matter how many character did you cut from the original string. a) b) c) d) 1 2 0 3 Ans: c 62) Which variables will be present in dataset FINAL. Its length is always $200 ( If it is not set explicitly using length statement). end. y=2.6. Run. output. KEEP NUM1 NUM3. Similarly when a variable is created by assigning the value returned by the SUBSTR function. DROP NUM2 NUM4 NUM7. set TRY1(KEEP= NUM1 NUM2 NUM3 NUM4) TRY2(KEEP= NUM5 NUM6 NUM7 NUM8). x=4. a) b) c) d) 4 23 1 200 Ans: b Note: Whenever a variable is created by assigning the value returned by the SCAN function. if x=5 then do. data FINAL. TRANWRD and COMPBL are the other two functions which return the value of length 200. A=’I was Bond. CITYCODE. NUM1 NUM3.00 ‚ 16. Ans: a Suggestions: 18 .00 a) b) c) d) PROC FREQ DATA=A.67 ‚ 66.67 ‚ 25. A) B) C) D) NUM1 NUM3 NUM5 NUM6 NUM8.00 ‚ ‚ 50.00 ‚ 100.00 ‚ 25.67 ‚ 16.67 100.67 ‚ 0. Warning in the log.67 ‚ 0.00 ‚ 0.00 ‚ 50.00 ‚ 100. PROC FREQ DATA=A.RUN.33 ‚ 50. VAR SEX CITYCODE. TABLES SEX*CITYCODE.00 ‚ 25.00 ‚ 0.00 ‚ 25. RUN. RUN.00 ‚ 50. TABLES SEX.33 16. RUN.00 ‚ 50. Ans:b 63) A dataset SEX_______CITYCODE__________JOB M NY WER F NY WER M WD RES M WD RES M SD ED M WF ED What will be the correct code to get a cross frequency table as following? The FREQ Procedure Table of SEX by CITYCODE SEX CITYCODE Frequency‚ Percent ‚ Row Pct ‚ Col Pct ‚NY ‚SD ‚WD ‚WF ‚ Total ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ F ‚ 1‚ 0‚ 1‚ 0‚ 2 ‚ 16.33 16.00 ‚ ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ Total 2 1 2 1 6 33. Syntax Error. TABLES SEX CITYCODE. RUN.00 ‚ 0.00 ‚ ‚ 50.00 ‚ 33. PROC FREQ DATA=A. PROC FREQ DATA=A.00 ‚ 0.00 ‚ ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ M ‚ 1‚ 1‚ 1‚ 1‚ 4 ‚ 16.67 ‚ 16.67 ‚ 16.67 33. input relation $ @. This will help you achieving good score in Handling Errors.) Practice well to differentiate between the cases of Syntax Error and Missing value. infile 'file'. if relation='children' then input sex $54. What is the value of EVENT in the dataset? a) January 1st b) '' (blank character value) c) no value as there is a syntax error in the datastep d) 01012000 ans c) as date constant uses ddmmmyyyy format i.e.) Please Go Through Programming Essentials I And II before appearing In Exam. Jan30-06 1. infile 'file'. 2. if date='01012000'd then EVENT='January 1st'. else if relation='parent' then input profession $. Array name related conceptual question 3. how many records from infile will be read for a record in the dataset? a) 0 19 . 2. run. Raw data file given is ----|---01012000 data temp. data temp. date='01jan2000'd is the correct option here. input date mmddyy10.1.. input Age. run. id style. proc print data=temp.55 Baths 120.22 Split Bedrooms 124. by style. var style bedrooms baths price.212 Baths 2.b) 1 c) 2 d) 3 ans 1 4.22 a) b) ans a 6. array address {12} address1-address12.158 Baths 12. infile 'file'. how many observations?? a) 0 b) 1 c) 2 d) 3 ans a (syntax error . data temp. columns style bedrooms baths price. id style 20 . run. retain address {12}.error in retain statement) 5. Style Condo Bedrooms 50. proc sort data=temp. <insert statements here for the exhibit shown> run. What should be the code for the exhibit shown below: proc report data=temp.225 Ranch Bedrooms 25. run. by style. Theory question related to SUM statement (not sum function) which is true for the SUM statement? a) SUM function is used in conjunction b) it creates an accumulator variable 9.22 a) define style/display width=9. Question on PROC REPORT which uses mean of Price (given in the exhibit)verify the values of price in dataset with the exhibit to identify the statistics used.2 c) maxdec= 7. which statement creates grandtotal of cost? a) grandtot=grandtot+cost. run. ans b 8.158 12.55 Baths 120.2 ans a 21 .225 25. b) retain grandtot=0. cost).<insert code>. run. define price/mean width=9. 10. b) define style/display width=9. which option limits the decimals for standard deviation in the proc below to 2 decimals proc means data=temp mean std max.22 Price 50. grandtot=sum(grandtot. ans a 7. c) retain grandtot. a) maxdec=2 b) format std 7.212 2. define price/sum width=9. (Dataset is also shown and the values of price in the exhibit is not mean) Style Condo Bedrooms Baths Ranch Bedrooms Baths Split Bedrooms 124. Usage of Display option in DEFINE statement in PROC REPORT. value of str3? a) London. infile 'file'. str3=str2||'England'. run. str='London. England ans a 13.11. jobcode='FA' jobcategory='1'. data temp. what wud be value of jobcode ans FA 12. 1. Input file has ----|-$1. run. value of price? a) 1120 b) $1.(missing) ans d Base qns 22 . run. data temp.120 data temp. 8). 14. input @1 price. England b) England c) London. England'. jobcode=jobcode||jobcategory. str2=substr(str.120 c) 2 d) . 0773 Dataset Bank has above data. What is the output of following code data newbank. proc means data=new (firstobs=500). run. c. run.0713 second 0. do i=1 to 3. A note appears in the SAS log indicating that the incorrect statement was saved to a SAS data set for further examination. cost+5000. Which of the following statements is true when SAS encounters a syntax error in a DATA step? a. proc print data=new (firstobs=100).Q1 first 0. The DATA step stops executing at the point of the error and the resulting data set contains observations up to that point. How many observations would be processed by following codes? options obs=500. The SAS log contains an explanation of the error. d.0715 third 0. run. b. The DATA step continues to execute and the resulting data set is complete. set banks. end. Ans: 401 obs in Proc Print 4501 obs in Proc Means Q3 1. Q4 23 . options obs=max. Ans: 1 observation n 4 variables Q2 There are 5000 observations in NEW dataset. and a SAS data set is created with zero observations.Department SAS data set contains a character variable named jobcode with a length of 5. 8 c. set work. Ans: FA1 Q7 1. data work. and execution continues. $1. and a system abend occurs.5 .department. Ans: ‘.accounting. 12 d. Which one of the following statements is true when SAS encounters a data error? a. Q5 What is the value stored in NUM after this code is submitted? data n2. b. The value cannot be determined because the program fails to execute due to syntax errors. input num 6.’ Q6 What is the value stored in variable THIRD after the following program is submitted? data n3. The execution phase is stopped.234. third=first||second. second='1'. run. 3. 4. first='FA'. length jobcode $ 12. 5 b. datalines. Which of the following is the length of the variable jobcode in the output data set? a. run. A missing value is assigned to the appropriate variable.1. 24 . The Work. The execution phase is stopped. The following SAS program is submitted: 2. run. c.. dy=23. run. run. if age le 50.yr). mn=3. yr=2000.dy. run. value rslt 1-50='Fail' 51-100='Pass'. input name $ age sales. Ans : 50. proc format. Dataset is SCORES.. A missing value is assigned to the appropriate variable.5. What will be the value printed when following FORMAT is applied to Marks of 50.d. Ans 4 observations 3 variables Q9 What is the value stored in NDATE when this code is executed? data n5. proc print data=scores. datalines.5 25 . and execution stops at that point. steve randall 45 5000 david shepherd 57 6000 russell tiffin 38 7000 simon taufel 32 4000 . run. format mark rslt. ndate=mdy(mn. Ans 14692 (SAS equivalent of 23-MAR-2000) Q10. Q8 How many records are there in the dataset when following code is submitted? data n4. var is Marks which holds marks. correct_answer = "A" Item 2 Given the SAS data set WORK. input Name $ Age.SAS Base Programming for SAS 9 Item 1 The following program is submitted. run. B.BOTH. data WORK. D. What is the first observation in the SAS data set WORK.ONE WORK. I.TWO: The following program is submitted: data WORK. merge WORK. Which values are stored in the output data set? A.ONE: Id --182 190 250 720 Id --182 623 720 Char1 ----M N O P Char2 ----Q R S and the SAS data set WORK. C. John +35 . H. by Id. E. F.TWO.TEST.BOTH? 26 . run. The DATA step fails execution due to data errors. G. Name John Name John Name (missing value) Age 35 Age (missing value) Age (missing value) --------------------- --------------------- --------------------- J. datalines. E. run. Id --182 Id --182 Id --182 Id --720 Char1 ----M Char1 ----- Char2 ----- D. O. E. C. I. What will the data set WORK. K. M. L. B. G. input @1 Var1 $ @8 Var2 $ @. correct_answer = "C" Item 3 Given the text file COLORS. J. Char2 ----Q Char1 ----M Char1 ----P Char2 ----Q Char2 ----S H. C. input @1 Var3 $ @8 Var4 $ @. K. Var1 -----RED BLUE CYAN GRAY Var1 -----RED CYAN Var2 -----ORANGE INDIGO WHITE BROWN Var2 -----ORANGE WHITE Var3 -----RED BLUE CYAN GRAY Var3 -----BLUE GRAY Var4 -----ORANGE INDIGO WHITE BROWN Var4 -----INDIGO BROWN G. F.COLORS. B. D. infile 'COLORS. H. N.COLORS contain? A. 27 .A.TXT: ----+----1----+----2----+---RED BLUE CYAN GRAY ORANGE INDIGO WHITE BROWN YELLOW PURPLE FUCSIA PINK GREEN VIOLET BLACK MAGENTA The following SAS program is submitted: data WORK. I. P. F. J.TXT'. Do not add leading or trailing spaces to your answer.ONE? Enter your numeric answer. output. T.INPUT. S. U. V. Var1 -----RED BLUE Var1 -----RED BLUE CYAN GRAY Var2 -----ORANGE INDIGO Var2 -----ORANGE INDIGO WHITE BROWN Var3 -----YELLOW PURPLE Var3 -----YELLOW PURPLE FUCSIA PINK Var4 -----GREEN VIOLET Var4 -----GREEN VIOLET BLACK MAGENTA Q.ONE. M.INPUT: Var1 -----A A B C A Var2 ------one two three four five The following SAS program is submitted: data WORK. R. correct_answer = "A" Item 4 Given the SAS data set WORK. P.ONE WORK. correct_answer = "8" Item 5 The following SAS program is submitted: data WORK.L. W. 28 . N. run. set WORK.LOOP.TWO. X. if Var1='A' then output WORK. X = 0. How many observations will be in data set WORK. O. P. value score run. E. C. end. run. I. 29 . J. 51 . Index = 7 correct_answer = "D" Item 6 The following SAS program is submitted: proc format. format test score.. N. run.50 = 'Fail' = 'Pass'. var test.CLASS.100 Which one of the following PRINT procedure steps correctly applies the format? A. proc print data = SASUSER. Index = 5 B. D. X = 3. Q. proc print data = SASUSER. C. run. O.LOOP? A. R. format test score.CLASS. H.CLASS format = score. Index = 5 X = 5. L.CLASS format = score. D. Index = 6 X = 5. proc print data = SASUSER. G. X = 5. what are the values of the variables X and Index in the SAS data set named WORK. B. K. Upon completion of execution..do Index = 1 to 5 X = Index. by 2. proc print data = SASUSER. correct_answer = "B" Item 7 This item will ask you to provide a line of missing code. M. run. var test. run. 1 . var test. F. var test. Given the following data set WORK. B. <insert code here> Total=Total+Cost. B. set WORK. Qtr1 = sum(of month{*}). array month{3} SalesJan FebSales MarchAmt.INPUT contains 10 observations.INPUT. C. The following SAS program is submitted to accumulate the total value of Cost for the 10 observations: data WORK. SalesJan -------50 25 . Qtr1 = sum(of month{3}). retain Total 0. Qtr1 = sum(of month{_ALL_}). <insert code here> run. If _N_= 1 then Total = 0. C. Which statement correctly completes the program? A.QTR1. and includes the numeric variable Cost. FebSales -------400 100 300 MarchAmt -------350 125 250 Qtr1 ---800 250 550 A. D.TOTAL. Total = 0. D. keep Total. correct_answer = "B" Item 8 This question will ask you to provide a line of missing code. FebSales -------400 100 300 MarchAmt -------350 125 250 The following SAS program is submitted: Which statement should be inserted to produce the following output? SalesID ------W6790 W7693 W1387 SalesJan -------50 25 . set WORK.The SAS data set WORK. Qtr1 = month{1} + month{2} + month{3}. run.SALES.SALES: SalesID ------W6790 W7693 W1387 data WORK. correct_answer = "C" 30 . run. ERROR: Variable bmi is not on file SASHELP. Change the ** in the BMI formula to a single * Change bmi to BMI in the WHERE statement Add a (Keep=BMI) option to the SET statement correct_answer = "A" Item 10 The following SAS program is submitted: data WORK.CLASS.CLASS. where bmi ge 20.4). set SASHELP. Replace the WHERE statement with an IF statement B.OUTPUT. D. What is the value of Char2? A. Char2=substr(Char1. C. BMI=(Weight*703)/Height**2. C.3.TEMP. Char1='0123456789'.Item 9 Given the following SAS error log 44 45 46 47 48 data WORK. 23 B. D. What change to the program will correct the error? A. 34 345 2345 correct_answer = "D" 31 . run.
Copyright © 2024 DOKUMEN.SITE Inc.