SAS Programming Fundamentals

Test your knowledge of SAS programming concepts including data steps, procedures, options, and data manipulation techniques.

17 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

data new; x = '1000'; y= x * .10; run; What is the result?

  1. y = '100'
  2. y = 100 and a NOTE is written in the SAS log saying that character value has been converted to numeric value
  3. y = 100 and no NOTE is written in the SAS log
  4. Program does not execute due to Syntax Errors
Question 2 Multiple Choice (Single Answer)

proc print data=sales; run; options ? proc means data=sales; run; Which option statement has to be used to reset the page number to 3 for the second report?

  1. options reset pagenum=3;
  2. options reset pageno=3;
  3. options pageno=3;
  4. options pagenum=3;
Question 3 Multiple Choice (Single Answer)

data quote; infile datalines dlm=','; input x y$; datalines; 10,"100" ; run; What will be the output?

  1. x y {10 }
  2. Syntax Error due to the double quotes
  3. x y { 10 "100" }
  4. x y { 10 100 }
Question 4 Multiple Choice (Single Answer)

data count; array x{3} (1,2,3); run; What is the result?

  1. No observations.No variables
  2. variable x is created with 3 observations with values 1,2 and 3
  3. Array should be given a name during initialization.Syntax Error
  4. The variables x1 , x2 and x3 are created with the values 1, 2 and 3
Question 5 Multiple Choice (Single Answer)

The output required from proc means is min, max and nmiss.Also the decimal values should be aligned to 2 digits.Which proc statement satisfies the requirement

  1. proc means; ( min max nmiss maxdec=2);
  2. proc means; var x /min max nmiss maxdec=2;
  3. proc means min max nmiss maxdec=2;
  4. proc means; var x ( min max nmiss maxdec=2);
Question 6 Multiple Choice (Single Answer)

The option available for displaying proc freq for getting a cross tabulation of the fields product and region is

  1. tables product/region;
  2. tables product * region;
  3. tables product,region;
  4. tables product region;
Question 7 Multiple Choice (Single Answer)

which of the following proc statement can be used to delete all the SAS datasets present in the library MyWork

  1. proc datasets lib=Mywork kill ;run;
  2. proc datasets lib=Mywork delete ;run;
  3. proc datasets; lib=Mywork delete ;run;
  4. proc datasets lib=Mywork erase ;run;
Question 8 Multiple Choice (Single Answer)

The option to give in order to make SAS to continue processing even if there are any formats that is given in the sas program is not available is

  1. options NOFMT;
  2. options NOFMTERR;
  3. options FMTERR;
  4. options NOERR;
Question 9 Multiple Choice (Single Answer)

proc format; value num 1-6 = 'High' 6-10= 'Low'; run;

  1. Format is not created
  2. Format is created with the name of num
  3. ERROR: These two ranges overlap: 1-6 and 6-10 (fuzz=1E-12).
  4. Syntax Error
Question 10 Multiple Choice (Single Answer)

data y; set x; length a $12; run; In the dataset x there is a variable called a which is numeric and of length 8.What is the result of this data step?

  1. No observations in dataset y
  2. variable a in dataset y will be numeric and of length 8
  3. variable a in dataset y will be character and of length 12
  4. Error since the variable a is defined as both character and numeric
Question 11 Multiple Choice (Single Answer)

There are 2 datasets sales and income.Sales has a variable pno and income has a variable product.Both are same.The third dataset has to be formed by merging sales and income that has the same products.Which is the correct option?

  1. data new;set income(in=IN_A rename=( product = pno)) sales(in=in_b); if IN_A and IN_B;run;
  2. data new;merge income(in=IN_A) (rename( product = pno)) sales(in=IN_B);run;
  3. data new;merge income(in=IN_A) (rename=( product = pno)) sales(in=IN_B);if IN_A and IN_B;run;
  4. data new;merge income(in=IN_A rename=( product = pno)) sales(in=in_b); if IN_A and IN_B;run;
Question 12 Multiple Choice (Single Answer)

Which macro variable contains the value of current date

  1. SYSDATE9
  2. DATE10
  3. SYSTIME
  4. DATE6
Question 13 Multiple Choice (Single Answer)

The report output should be {x y } {1 2} {2 5} {Total 2} Choose the correct option. NOTE { } are added for readability

  1. proc print data = new N='total';
  2. proc print data = new sum='total';
  3. proc print data = new; sum/ label='total';
  4. proc print data = new sum; label='total';
Question 14 Multiple Choice (Single Answer)

The default number of error messages that are displayed in SAS log is

  1. 3
  2. 6
  3. 5
  4. 20
Question 15 Multiple Choice (Single Answer)

In order to write each input record into the log the option used is

  1. put ;
  2. put list;
  3. list;
  4. put LIST;
Question 16 Multiple Choice (Single Answer)

To display all the values of all the variables in the log, the option used is

  1. put ALLVAR
  2. put VAR
  3. put ALL;
  4. put ;
Question 17 Multiple Choice (Single Answer)

x=intck('week.4','01JAN2010'd,'01FEB2010'd); What is the value of x ?

  1. 0
  2. Syntax Error - week.4
  3. 5
  4. 4