DATA Step, Macro, Functions and more

What is the +2 in the below code ?

Reply
Occasional Contributor
Posts: 13

What is the +2 in the below code ?

 

What is the meaning of +2 in below code ?

What will be the impact on output ?

 

data abc;
input Type $ 1-5 + 2 Color $;
datalines;
daisyyellow
;
run;

Super User
Posts: 6,921

Re: What is the +2 in the below code ?

Posted in reply to vishalrajpoot3

Having just read columns 1 through 5 to get a value for TYPE, SAS is now positioned to look for the next variable starting at column 6.  The "+2" tells SAS to move two columns to the right, so it will start looking for a value for COLOR at column 8.

Respected Advisor
Posts: 3,258

Re: What is the +2 in the below code ?

[ Edited ]
Posted in reply to vishalrajpoot3

It means that there are 2 ignored characters to the right of position 5 (the end of variable Type) before variable color is read.

 

What is the impact on the output? Some things are left for the user to figure out. A simple way to figure out what the impact on the output will be is to actually run the code.

--
Paige Miller
Ask a Question
Discussion stats
  • 2 replies
  • 45 views
  • 0 likes
  • 3 in conversation