BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I saw this code.

May anyone explain please why do they use informat $12.? (why not $10 for example)?

May anyone explain please why do they use input pointers +4 and +6?why not other numbers?

I see that var name has maximum 9 digits

I see that var score1 has 5 digits(included comma)

I see that var score2 has 5 digits(included comma)

 

data scores;
   input name $12. +4 score1 comma5. +6 score2 comma5.;
   cards;
Riley           1,132      1,187
Henderson       1,015      1,102
;
Run;

1 REPLY 1
andreas_lds
Jade | Level 19

Someone should have written a record-description: a least a table describing the data to be found in a file matching the description. Without that description it is hardly possible to know why $12 has been used, maybe because the data will be merged using the name-variable and it has been defined with length=12 in the other dataset.

 

The +4 / +6 move the column-pointer to the first char of the variable.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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