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

I found out the answer by creating the color.txt  file and submitting in the SAS Univ Edn. However,I couldn't figure out the reason for the answer.

 

The question is :

 

Given the text file COLORS.TXT:

----+----1----+----2----+----
RED    ORANGE  YELLOW  GREEN
BLUE   INDIGO  PURPLE  VIOLET
CYAN   WHITE   FUCSIA  BLACK
GRAY   BROWN   PINK    MAGENTA

The following SAS program is submitted:

data WORK.COLORS;
  infile 'COLORS.TXT';
  input @1 Var1 $ @8 Var2 $ @;
  input @1 Var3 $ @8 Var4 $ @;
run;

What will the data set WORK.COLORS contain?

 

 

options are:

 

 

  1. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   RED     ORANGE
    BLUE     INDIGO   BLUE    INDIGO
    CYAN     WHITE    CYAN    WHITE
    GRAY     BROWN    GRAY    BROWN
  2. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   BLUE    INDIGO
    CYAN     WHITE    GRAY    BROWN
  3. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   YELLOW  GREEN
    BLUE     INDIGO   PURPLE  VIOLET
  4. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   YELLOW  GREEN
    BLUE     INDIGO   PURPLE  VIOLET
    CYAN     WHITE    FUCSIA  BLACK
    GRAY     BROWN    PINK    MAGENTA

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

 

RTM. What does the documentation say regarding the trailing @?

 

@

holds an input record for the execution of the next INPUT statement within the same iteration of the DATA step. This line-hold specifier is called trailing @.

Restriction The trailing @ must be the last item in the INPUT statement.
Tip The trailing @ prevents the next INPUT statement from automatically releasing the current input record and reading the next record into the input buffer. It is useful when you need to read from a record multiple times.
See Using Line-Hold Specifiers
Holding a Record in the Input Buffer

 

 

View solution in original post

7 REPLIES 7
Sathiskumar_D
Obsidian | Level 7

I found out the answer by creating the color.txt  file and submitting in the SAS Univ Edn. However,I couldn't figure out the reason for the answer.

 

The question is :

 

Given the text file COLORS.TXT:

----+----1----+----2----+----
RED    ORANGE  YELLOW  GREEN
BLUE   INDIGO  PURPLE  VIOLET
CYAN   WHITE   FUCSIA  BLACK
GRAY   BROWN   PINK    MAGENTA

The following SAS program is submitted:

data WORK.COLORS;
  infile 'COLORS.TXT';
  input @1 Var1 $ @8 Var2 $ @;
  input @1 Var3 $ @8 Var4 $ @;
run;

What will the data set WORK.COLORS contain?

 

 

options are:

 

 

  1. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   RED     ORANGE
    BLUE     INDIGO   BLUE    INDIGO
    CYAN     WHITE    CYAN    WHITE
    GRAY     BROWN    GRAY    BROWN
  2. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   BLUE    INDIGO
    CYAN     WHITE    GRAY    BROWN
  3. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   YELLOW  GREEN
    BLUE     INDIGO   PURPLE  VIOLET
  4. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   YELLOW  GREEN
    BLUE     INDIGO   PURPLE  VIOLET
    CYAN     WHITE    FUCSIA  BLACK
    GRAY     BROWN    PINK    MAGENTA

 

 

Reeza
Super User

@Sathiskumar_D Please do not post the same question multiple times. It will not increase the number of responses and isn't helpful. 

Sathiskumar_D
Obsidian | Level 7

When I posted the question first time, it didn't aacept the question.I am not aware of the fact that my previous question was posted.My apologies.

Reeza
Super User

 

RTM. What does the documentation say regarding the trailing @?

 

@

holds an input record for the execution of the next INPUT statement within the same iteration of the DATA step. This line-hold specifier is called trailing @.

Restriction The trailing @ must be the last item in the INPUT statement.
Tip The trailing @ prevents the next INPUT statement from automatically releasing the current input record and reading the next record into the input buffer. It is useful when you need to read from a record multiple times.
See Using Line-Hold Specifiers
Holding a Record in the Input Buffer

 

 

Sathiskumar_D
Obsidian | Level 7

SAS prep Guide says that '@' or '@@' cannot be used with @pointer control, with column input, nor with the MISSOVER option.In my question, however, there is '@'pointer control.

Reeza
Super User

Either it's incorrect or you're misunderstanding the text.

What's the page reference for this, I'm assuming SAS Base Certification Prep guide, what version? 

 

http://support.sas.com/publishing/cert/basecertguide3.html 

 

 

Sathiskumar_D
Obsidian | Level 7

It is Third Edition (Page # 608 and Chapter 20).They had provided an example where '@' pointer control was NOT used.However, the caveat, that was mentioned, is for double trailing '@@'.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 7 replies
  • 1500 views
  • 0 likes
  • 2 in conversation