BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

@mdoddala wrote:
But the Id in input statement overrides the 3 bytes in the length statement with 8 bytes

SAS will define the variable as soon as it has to.  Variables will only be defined by how they are used in an INPUT statement if they have not already been defined.  Since ID was defined already as length $3 by the LENGTH statement the INPUT statement does not change that.   

 

Don't get confused by the ability to add a bare $ modifier in an INPUT statement. That is only needed if you have not previously defined the variable as character.  The bare $ modifier is just for convenience when you haven't previously defined the variable and you don't want the INPUT statement's reference to the variable to cause it to be created as numeric.  So if the first reference to the variable is the INPUT statement you need to add the $ (or include a character informat) or SAS will define the variable as numeric.

mdoddala
Obsidian | Level 7

Thanks for the clarification:)

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 16 replies
  • 6733 views
  • 12 likes
  • 7 in conversation