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:)

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