Given the following code:

Which variables are created with the BY statement?
Suggested Answer: A
Get Premium A00-215 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
In SAS, when you use a BY statement in a DATA step, SAS creates two temporary variables for each variable listed in the BY statement: one to indicate the first occurrence (FIRST.variable) and another to indicate the last occurrence (LAST.variable) of the value within the BY-group. Given the provided code and assuming that State is the variable used in the BY statement, SAS will create First.State and Last.State. Thus, option A is correct.
SAS documentation on the BY statement, SAS Institute.
34 comments · newest first
VI
Vi
10 months ago
B doesn't make sense, it's not how variable naming works.
XE
Xenia
10 months ago
I agree with A, that's how BY statements work!
JI
Jin
10 months ago
Wait, are we sure about that? Seems off to me.
DY
Dyan
11 months ago
I think it's actually C, not A.
JE
Jennifer
11 months ago
Definitely A, those are the right variables.
DU
Dustin
11 months ago
I thought the BY statement only created variables for the first and last names, but now I'm questioning if that's right.
LO
Lorean
11 months ago
I feel like it's definitely First_State and Last_State, but I might be mixing it up with another example we did in class.
CA
Carla
12 months ago
I remember practicing a similar question where the BY statement defined new variables, but I can't recall the exact names.
CH
Cheryll
12 months ago
I think the BY statement creates variables based on the grouping, but I'm not sure if it's First and Last or something else.
BR
Brittani
1 year ago
I'm going to carefully analyze the code and the variable naming conventions to determine the right answer. The key is understanding how the BY statement works in this context.
VI
Vi
1 year ago
Wait, I'm confused. The options mention State. First, State. Last, First. State, and Last. State. I'm not sure which one is correct.
DE
Denna
1 year ago
Okay, I think I've got this. The BY statement is creating variables based on the First. and Last. prefixes, so the answer is likely D. First. and Last.
GE
Georgeanna
1 year ago
Hmm, I'm a bit unsure about this one. The BY statement can create some tricky variable names, so I'll need to think it through step-by-step.
AS
Ashleigh
1 year ago
This looks like a straightforward question about the BY statement in SAS. I'll need to carefully read the code and options to determine which variables are created.
RE
Rene
1 year ago
Haha, this is an easy one. If you can't figure out that C is the right answer, you might want to rethink your career choice!
EM
Emelda
1 year ago
D) First. and Last.
KR
Kris
1 year ago
C) First_State and Last_State
BE
Bette
1 year ago
B) First. State and Last. State
FA
Fatima
1 year ago
A) State. First and State. Last
GO
Goldie
1 year ago
This question is pretty straightforward. The BY statement is clearly creating new variables with the names First_State and Last_State.
LY
Lynelle
1 year ago
C) First_State and Last_State
CH
Christa
1 year ago
B) First. State and Last. State
MA
Marge
1 year ago
A) State. First and State. Last
DA
Daron
1 year ago
I think the answer is D) First. and Last. because those are the variables created by the BY statement
DA
Dante
1 year ago
I agree with Vivienne. The code shows that the variables created are First_State and Last_State, not the options in A, B, or D.
FL
Flo
1 year ago
Yes, I agree. It's not State. First and State. Last as mentioned in the options.
HA
Haley
1 year ago
I think you're right, the variables created are First_State and Last_State.
CL
Clorinda
1 year ago
But the BY statement creates variables for the first and last observations in a BY group, so A) makes more sense
AN
Annette
1 year ago
I disagree, I believe the answer is B) First. State and Last. State
CL
Clorinda
1 year ago
I think the answer is A) State. First and State. Last
VI
Vivienne
1 year ago
The correct answer is C) First_State and Last_State. The BY statement creates new variables with the prefix of the variable names.
CH
Chantell
1 year ago
You are right, the BY statement creates new variables with the prefix of the variable names.
SO
Socorro
1 year ago
No, I believe it is C) First_State and Last_State
CA
Carri
1 year ago
I think the correct answer is A) State. First and State. Last