Multiple choice technology programming languages

Dataset: A SEQID 1 2 Data B; do i =1 to 10; set A; c = n; output; end; run; How many observations will be there in dataset B & what will be the final value of c?

  1. 20 20

  2. 20 2

  3. 2 2

  4. 2 1

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

The SET statement reads dataset A once (it has 2 observations: SEQID 1 and 2). The DO loop iterates from 1 to 10, but SET only executes once at the start. So we get 2 observations total (one from each row in A). The n variable counts iterations, ending at 2, not 10.