BookmarkSubscribeRSS Feed
vishalrajpoot3
Obsidian | Level 7

 

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;

2 REPLIES 2
Astounding
PROC Star

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.

PaigeMiller
Diamond | Level 26

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

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