Multiple choice technology

Which of the following program contains a syntax error?

  1. Proc Sort data=sasuser.mysales; by city; run;

  2. Dat sasuser.mysales; set mydata.sales99; run;

  3. Proc Print data=sasuser.mysales label; label city='Mumbai'; run;

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SAS keywords must be spelled exactly as required. Option B uses 'Dat' instead of 'DATA', which is a syntax error - SAS statements must begin with the correct keyword. The other options have valid SAS syntax.

AI explanation

To answer this question, we need to analyze each program option and identify if any of them contain a syntax error.

Option A) Proc Sort data=sasuser.mysales; by city; run; This program is a valid SAS code. It uses the PROC SORT statement to sort the dataset sasuser.mysales by the variable city. It does not contain any syntax errors.

Option B) Dat sasuser.mysales; set mydata.sales99; run; This program contains a syntax error. The correct keyword to define a dataset is DATA, not DAT. Therefore, the correct statement should be DATA sasuser.mysales;. This option contains a syntax error.

Option C) Proc Print data=sasuser.mysales label; label city='Mumbai'; run; This program is a valid SAS code. It uses the PROC PRINT statement to print the dataset sasuser.mysales with a label. It also assigns the label 'Mumbai' to the variable city. It does not contain any syntax errors.

Option D) None of the above This option is incorrect because option B contains a syntax error.

Therefore, the correct answer is B) Option B. This option contains a syntax error because it uses the incorrect keyword DAT instead of DATA to define a dataset.