SAS and C Programming Fundamentals

Test your knowledge of SAS programming including DATA steps, datasets, loops, and functions, along with C language syntax and basic programming concepts.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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. data temp; infile ‘file specification’; input x $ 1-3; if x='sue' then input age 5-6; else input height 8-9; run; what would be the value of variable AGE in the dataset TEMP when variable X has the value ‘Sue’?

  1. 44
  2. 30
  3. 40
  4. 55
Question 2 Multiple Choice (Single Answer)

Flat file structure is as below (Very good question) 1----5----10 vital reddy 45 vijay 30 sarma 40 The following code is submitted. data temp; infile ‘file specification’; input x $ age; if age<=40; run; How many observations will be there in the TEMP dataset?

  1. 3
  2. 2
  3. 0 observations
  4. syntax error
Question 3 Multiple Choice (Single Answer)

The following code is submitted. data temp; salary='20000'; bonus=0.1*salary; run; What would be the value of BONUS variable in the dataset TEMP?

  1. '2000'
  2. 2000
  3. .
  4. blank
Question 4 True/False

We can write the program without main() in C language

  1. True
  2. False
Question 5 Multiple Choice (Single Answer)

data temp; salary=.; if salary=. then salary=100; bonus=10; salary=.; total=sum(salary,bonus); run; What would be the value of TOTAL variable in the dataset TEMP?

  1. 100
  2. 110
  3. 10
  4. .
Question 6 Multiple Choice (Single Answer)

Following code is submitted. data temp: do i=1 to 3; do j=1 to 4; salary=salary+300; end; end; run; how many observations will present in the dataset TEMP?

  1. 1
  2. 3
  3. 2
  4. 0
Question 7 Multiple Choice (Single Answer)

The variable JOBCODE has length $5 in the dataset TEMP. The same variable present in the dataset TEMP1 and has length $7. data temp2; set temp temp1; run; what would be the length of the variable JOBCODE in the dataset TEMP2?

  1. 5
  2. 7
  3. c) we can’t see the length as data set won’t be created due to errors.
  4. none
Question 8 Multiple Choice (Single Answer)

What is the maximum combined length of command line arguments including the space between adjacent arguments?

  1. 32 K
  2. 42 K
  3. 23 K
  4. 24 K
Question 9 Multiple Choice (Single Answer)

Which one is equivalent to multiplying by 2?

  1. None of the below
  2. Left shifting an unsigned int or char by 1
  3. Left shifting a number by 1
  4. Both
Question 10 Multiple Choice (Single Answer)

Which is the correct syntax for the function gcvt() in C?

  1. char *gcvt(double value,int digit,char buf);
  2. char *gcvt(double value,int digit,char *buf);
  3. char *gcvt(double value,int digit,char *buf)
  4. char *gcvt(double value,int digit,char buf)
Question 11 Multiple Choice (Single Answer)

To which numbering system can the binary number 1101100100111100 be easily converted to?

  1. Octal
  2. Binary itself
  3. Hexa decimal
  4. None of the above
Question 12 Multiple Choice (Single Answer)

son,Travis, The following output is desired relation firstname son Travis Which one of the following statements will work correctly as exepcted ?

  1. data family/dlm = ',';
  2. options dlm=',';
  3. infile 'file-specification' dlm=',';
  4. input relation $ firstname $ /dlm=',';
Question 13 Multiple Choice (Single Answer)

data sasdata.atlanta sasdata.boston work.portland work.phoenix; set company.prdsales; if region='NE' then output boston; if region='SE' then output atlanta; if region='SW' then output phoenix; if region='NW' then output portland; Which one of the following is true regarding the output datasets

  1. No library references are required
  2. The datasets listed on all the IF statements require a library reference
  3. The datasets listed on the last two IF statements require a library reference
  4. The datasets listed on the first two IF statements require a library reference
Question 14 Multiple Choice (Single Answer)

The sasdata.banks dataset has 5 observations when the following SAS program is submitted data allobs; set sasdata.banks; capital=0; do year = 2000 to 2020 by 5; capital + ((capital + 2000) * rate); output; end; run; How many observations will the ALLOBS data set contain?

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

----|----10----|----20----|----30 john McCloskey 35 71 June Rosesette 10 43 Tineke Jones 9 37 The following SAS program is submitted using the raw data file as input: data work.homework; infile 'file-specification'; input name $ age height; if age LE 10; run; How many observations will the WORK.HOMEWORK dataset contain?

  1. 0
  2. 3
  3. 2
  4. No dataset is created as the program fails to execute due to errors
Question 16 Multiple Choice (Multiple Answers)

The attribute information includes the variable’s name, type, ......

  1. Length
  2. Format
  3. Informat
  4. Label
Question 17 Multiple Choice (Multiple Answers)

Some of the dataset options are

  1. print the observations of the dataset
  2. renaming variables
  3. selecting only the first or last n observations for processing
  4. dropping variables from processing or from the output data set
Question 18 Multiple Choice (Single Answer)

The general form of SUM statement is

  1. variable = variable+expression;
  2. variable+expression;
  3. sum(expression,variable)
  4. expression=variable+expression;
Question 19 True/False

The sum statement is equivalent to using the SUM function and the RETAIN statement, as shown here: retain variable 0; variable=sum(variable,expression);

  1. True
  2. False
Question 20 Multiple Choice (Single Answer)

The following SAS program is submitted: data work.flights; destination='CPH'; select(destination); when('LPR') city = 'London'; when('CPH') city='Copenhagen'; otherwise; end;run; Which one of the following is the value of the CITY variable?

  1. London
  2. Copenh
  3. Copenhagen
  4. Missing