@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.
Thanks for the clarification:)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.