BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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