SAS Certification

Set yourself apart with a SAS Certification credential
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Teeleaf
Fluorite | Level 6

Which one is the correct answer? Chapter 4 quiz, question 3, the answer key shows the correct answer is a. However, the explanation seems more like choice b. Below are the answer and question.

 

Correct answer: a
Use the OBS= option in the OPTIONS statement before the IMPORT procedure to limit the number of observations that SAS reads from the external file. When you use the OBS= option in the PROC PRINT statement, the whole file is imported but printing is limited to the number of observations specified. Use DELIMITER='.' to indicate that the delimiter is a period (.) and use GETNAMES=YES to read in the first line, which contains the variable name

 

here is the question:

Which program correctly imports only the first seven lines from the external file that is delimited by a period (.) ? Hint: the first line in the external file contains variable names that you want to read in.

a.
options obs=7;
proc import data="C:\users\test.txt" out=exam dbms=dlm replace;
getnames=yes; run;
proc print data=exam; run;

 

b. options obs=7;
proc import datafile="c:\users\test.txt" out=exam dbms=dlm replace;
delimiter='.'; getnames=yes;
run;
proc print data=exam; run;

 

c.
proc import datafile="c:\users\test.txt"

out=exam dbms=dlm replace;
delimiter=' '; getnames=no;
run;
proc print data=exam (obs=7); run;


d.
proc import datafile="c:\users\test.txt" out=exam dbms=csv replace;
delimiter=','; getnames=no;
run;
proc print data=exam; options obs=7;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
4 REPLIES 4
Teeleaf
Fluorite | Level 6

Thanks very much Reeza for the confirmation and updates!!

ganeshmule
Fluorite | Level 6

i was also had that doubt on wrong option in SAS Prep guid 9.4 has wrong option instead of 'B' they have in the book 'A' which is wrong the right answer is option 'B'.

b)
options obs=7;
proc import datafile="c:\users\test.txt"
out=exam
dbms=dlm
replace;
delimiter='.';
getnames=yes;
run;
proc print data=exam;
run;

Reeza
Super User
As mentioned previously, this is noted in the errata document. In the 'print era' books cannot be updated after they're published so instead they published a separate document indicating any changes. This document already contains this information.

Welcome to the Certification Community

 

This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:

Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers

 

Why Get SAS Certified.jpg

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2591 views
  • 2 likes
  • 3 in conversation