☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Obsidian | Level 7

Practice exam question re Infile and Input

I'm taking a practice exam for Base Programming Performance-Based Certification Exam for SAS 9.4 and am stuck on what I know is a simple question.

For the following question, I thought the obvious answer was 1 numeric variable (answer B). But the answer key says 0 (answer A). Why is that? Thanks in advance!

The following SAS program is submitted:

``````data employees;
infile 'file-specification';
input @1 name \$10.
@15 date date9.
@25 department \$;
Run;``````

How many numeric variables are created:

A. 0

B. 1

C. 2

D. 3

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

Re: Practice exam question re Infile and Input

@TheresaM wrote:

I'm taking a practice exam for Base Programming Performance-Based Certification Exam for SAS 9.4 and am stuck on what I know is a simple question.

For the following question, I thought the obvious answer was 1 numeric variable (answer B). But the answer key says 0 (answer A). Why is that? Thanks in advance!

The following SAS program is submitted:

``````data employees;
infile 'file-specification';
input @1 name \$10.
@15 date date9.
@25 department \$;
Run;``````

How many numeric variables are created:

A. 0

B. 1

C. 2

D. 3

You are right.  Either the answer key is wrong or there is something different about the actual question or the actual code from what you posted.

13 REPLIES 13
Super User

Re: Practice exam question re Infile and Input

@TheresaM wrote:

I'm taking a practice exam for Base Programming Performance-Based Certification Exam for SAS 9.4 and am stuck on what I know is a simple question.

For the following question, I thought the obvious answer was 1 numeric variable (answer B). But the answer key says 0 (answer A). Why is that? Thanks in advance!

The following SAS program is submitted:

``````data employees;
infile 'file-specification';
input @1 name \$10.
@15 date date9.
@25 department \$;
Run;``````

How many numeric variables are created:

A. 0

B. 1

C. 2

D. 3

You are right.  Either the answer key is wrong or there is something different about the actual question or the actual code from what you posted.

Super User

Re: Practice exam question re Infile and Input

Date9 is numeric, so 1 is correct.
Obsidian | Level 7

Re: Practice exam question re Infile and Input

Sorry everyone! I just conferred with a fellow student and he reminded me that the . after the character \$10 length declaration is a syntax error, and so no variable gets created.  But thank you to those who offered help!

Super User

Re: Practice exam question re Infile and Input

It's best to test, which does not align with your classmates statement.

Then you can also run a PROC CONTENTS on the sample data to see the variable types.

However, the exact wording of the question may also matter.

@TheresaM wrote:

Sorry everyone! I just conferred with a fellow student and he reminded me that the . after the character \$10 length declaration is a syntax error, and so no variable gets created.  But thank you to those who offered help!

Obsidian | Level 7

Re: Practice exam question re Infile and Input

Thank you, Reeza. I ran a test as you recommended and found the same, of course.

I triple-checked that I typed the question exactly how it is in the exam, but below is a screenshot of the question and the answer key. I think that, based on our test code, and the two other people's responses, the practice exam seems to be incorrect.

Super User

Re: Practice exam question re Infile and Input

Where did you get the practice exam?  Did you pay money for it?  Can you get your money back?

Obsidian | Level 7

Re: Practice exam question re Infile and Input

The practice exam was given as an "extra resource" from a course I took. I suppose the unspoken caveat is that the practice exams were given to us as-is. The course was a good one, but it's possible these practice exams are not as good as the vetted ones from certified sources.  I'm switching over to the official SAS practice exam now. 🙂

SAS Employee

Re: Practice exam question re Infile and Input

I think you will need to carefully reconsider the course that you have taken, and this practice exam. I see where you said you are going to switch to the SAS official practice exam for the A00-231 exam, so that is good news. Not only is the question not provided with the accurate correct answer, but it is also covering a topic (reading raw data with infile/input) that has not been part of an exam since before 2019. So if the course focused on this as topic area, I would question the entire course as relevant to the current exam. Please refer to the SAS Certification Website for the Base Programming Specialist for the exam content guide as well as other important preparation resources.

Obsidian | Level 7

Re: Practice exam question re Infile and Input

Thanks @Mark2010 .  Points well-taken. I've switched over to official SAS guides to lessen future unnecessary confusion!  I've also been updating the course instructors with this type of information, and they have so far appreciated the feedback.

Obsidian | Level 7

Re: Practice exam question re Infile and Input

Also, yes, I've GREATLY appreciated provided in the preparation resources page you posted. I should have revisited the exam content guide before tearing my hair out over questions that address topics no longer covered in the exam. 😁

Super User

Re: Practice exam question re Infile and Input

@TheresaM wrote:

Sorry everyone! I just conferred with a fellow student and he reminded me that the . after the character \$10 length declaration is a syntax error, and so no variable gets created.  But thank you to those who offered help!

Since there is no LENGTH statement shown I am not sure why this is brought up.

Plus it is not a syntax error as shown here:

```16   data junk;
17      length x \$10.;
18      x='abcdefghijk';
19   run;

NOTE: The data set WORK.JUNK has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
```

The value of X will be truncated to 10 characters because of the length statement. In fact SAS won't even care if you include a decimal value (ignored)

```41   data junk;
42      length x \$10.5;
43      x='abcdefghijk';
44   run;
```

Obsidian | Level 7

Re: Practice exam question re Infile and Input

Thank you -- every piece of information has been helpful. I did look for the answer online, but was confusing informat delimiters with length statements. I've emailed our course instructor to see what they say regarding the question/answer key from the practice exam they gave to us.  I'm understanding that SAS is forgiving, and may ignore things that are unnecessary and still execute the code.  Of course I am also interested in what the official answer would be that the Certification Exam would consider correct.

Super User

Re: Practice exam question re Infile and Input

@TheresaM wrote:

Sorry everyone! I just conferred with a fellow student and he reminded me that the . after the character \$10 length declaration is a syntax error, and so no variable gets created.  But thank you to those who offered help!

That has nothing to do with your original question.

SAS is in general very forgiving of some mistakes.  The length of a variable is always an integer (since it is a count of the number of bytes to use) so there is no need to include a decimal point in a LENGTH statement.  But that will not cause any error or even any note or warning.

Discussion stats
• 13 replies
• 3192 views
• 6 likes
• 5 in conversation