BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
monicaco
Calcite | Level 5

Hi all,

 

I have a question about quiz chapter 4 - question 3:

 

3. 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.

 

Book answer:

3. 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 names.

 

Code a.:

options obs=7;

proc import data="C:\users\test.txt" 

  out=exam 

  dbms=dlm 

  replace; 

  getnames=yes;

run;

proc print data=exam;

run;

 

However, I think correct answer is code option "B" with the book answer explanation

Code 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;

 

Could someone clarify me this point?

 

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
sabisw
SAS Employee

@monicaco, thank you for your question. 

You are correct it is Option B. 

 

We have documented this in our Content Updates page.

 

Thanks,

Samantha

View solution in original post

1 REPLY 1
sabisw
SAS Employee

@monicaco, thank you for your question. 

You are correct it is Option B. 

 

We have documented this in our Content Updates page.

 

Thanks,

Samantha

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 746 views
  • 0 likes
  • 2 in conversation