The following SAS program is submitted and reads 100 records from a raw data file: data work.total; infile 'file-specification' end = eof; input name $ salary; totsal + salary;
run; Which one of the following IF statements writes the last observation to the output data set?
Explanation: end is sas keyword which will become true when SAS reads last record of a dataset. This value you cannot use directly in your program, so we create a alias name eof (end of file), but you can name it anything. EOF will carry the same value as internal variable END. So as we know 1=true and 0= false. if EOF = 1; will output only the last observation. Answer is 4
Question :
The following SAS program is submitted: libname rawdata1 'location of SAS data library'; filename rawdata2 'location of raw data file'; data work.testdata; infile input sales1 sales2; run; Which one of the following is needed to complete the program correctly?
Explanation: no need quotation mark for infile or filename. but the location needs within the quotation mark. Since if you have already intialized the path with a filename,you dont have to include quotation again.
Question : The contents of the raw data file TYPECOLOR are listed below: ---------10--------20--------30 daisyyellow The following SAS program is submitted: data flowers; infile 'typecolor'; input type $ 1-5 +1 color $; run; Which one of the following represents the values of the variables TYPE and COLOR? 1. type color daisy yellow 2. type color daisy ellow 3. Access Mostly Uused Products by 50000+ Subscribers daisyyellow (missing character value) 4. No values are stored as the program fails to execute due to syntax errors.
Explanation: by default sas proceeds to next column. here after reading 5 colums for type the position of the pointer is at y. due to +1 cursor moves to one column more
The column numbers at the top are wrong. They should be: ---------10--------20--------30 daisyyellow
We should be allowed the "pre" tag to display fixed-width code.
Are we to assume that typecolor in: infile 'typecolor'; is substituted with the path to the file?
If so, B is the correct answer: After input type $ 1-5, the pointer is on the "y", +1 causes the pointer to skip over it.
Ans : 2 Exp : Clearly, the DATE and NUMBER (page number) options are specified. Because the page number on the output is 1, even though PROC TABULATE output was just produced, PAGENO=1 must also have been specified. If you don't specify PAGENO=, all output in the Output window is numbered sequentially throughout your SAS session.
Question :
Which of the following programs correctly references a SAS data set named SalesAnalysis that is stored in a permanent SAS library?
1. data saleslibrary.salesanalysis; set mydata.quarter1sales; if sales>100000; run; 2. data mysales.totals; set sales_99.salesanalysis; if totalsales>50000; run; 3. Access Mostly Uused Products by 50000+ Subscribers var sales salesrep month; run; 4. proc freq data=1999data.salesanalysis; tables quarter*sales; run;
Ans : 2 Exp : Librefs must be 1 to 8 characters long, must begin with a letter or underscore, and can contain only letters, numerals, or underscores. After you assign a libref, you specify it as the first level in the two-level name for a SAS file.
Question : You have been given below SAS program, select the statement which is correct
data course100 ; Fee=5000; FEE_HIKE=0.1;
do month=1 to 12 ; INCREASE+(FEE+INCREASE)*FEE_HIKE; iteration+1; output; end; put _all_; run;
A. There would be 12 iteration B. Output statement will help in generating only last observation as an output. C. Last value hold by month variable will be 13 D. Iteration variable is redundant, and does not help in creating output.