1 data work.demo;
3 if value='SAS' then message='SAS Program';
4 else message='other';
5 length message 8;
ERROR: Numeric length cannot be used with character variable message.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DEMO may be incomplete. When this step was stopped there were 0
observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
At compile time, because of the assignment within the IF statement, the variable message will be created as an 11-byte character variable in the descriptor portion of the dataset. A later attempt by the LENGTH statement to define this variable as numeric will cause a syntax error that will stop the execution of this step and prevent a value from being assigned to the variable.
The one and only FREE resource for general SAS online training as well as study guides for the SAS Base Certification. My goal is to create the SAS Certification prep guide that I never found but always wanted. This should also be a place to come if you are new to the language but are simply looking for online SAS training.