The descriptor and data portions of the Work.Salaries data set are shown below.
Variable Type Len Pos --------------------- name Char 8 0 salary Char 8 16 status Char 8 8
name status salary ---------------------- Liz S 15,600 Herman S 26,700 Marty S 35,000
The following SAS program is submitted:
proc print data=work.salaries; where 20000 > salary;run;
What is displayed in the SAS log after the program is executed?
1. A NOTE indicating that 1 observation is read. 2. A NOTE indicating that 0 observations were read 3. Access Mostly Uused Products by 50000+ Subscribers 4. An ERROR indicating that the WHERE clause operator requires compatible variables.
Exp: Salary is defined as a character variable. Therefore, the value in the WHERE statement must be the character value 20,000 enclosed in quotation marks.
salary is char form, if not, "" can convert their own, can do no wrong
Question :
Which of the following statements is true when SAS encounters a syntax error in a DATA step?
1. The SAS log contains an explanation of the error. 2. The DATA step continues to execute and the resulting data set is complete. 3. Access Mostly Uused Products by 50000+ Subscribers 4. A note appears in the SAS log indicating that the incorrect statement was saved to a SAS data set for further examination.
Explanation: SAS 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.
Question :
Which TITLE statement would display JANE'S DOG as the text of the title?
Explanation: The 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.
2. Using PROC PRINT statement you can print all the ROWS and COLUMNS which exists in dataset. However, you can request more sample data to be extracted if required.
4. PROC PRINT displays all observations and variables in the dataset, a column for observation numbers will be first left. Variable will be printed in the same order in which they are stored with the dataset.