@zimu94681 wrote:
I just want to confirm that in length statement, when you define the length as "$10"
Is it means that this cell can only contain a word/phrase less than 10 characters?
Is one character use 1 byte?
Thanks!
The length is the number of BYTES that are stored in the dataset. For character variables that is also the number of bytes they can contain in the processing of the data step. For numeric variables they always need 8 bytes but the LENGTH can be used to control how many bytes are written to the dataset. On Windows/Linux this can be between 3 and 8 bytes. Z/OS you can also store numbers in just 2 bytes.
The number of characters that will fit in a fixed number of bytes depends on what encoding your SAS session is using. If you are using a single byte encoding, like WLATIN1, then each character takes one byte. If you are using double byte characters (common with Japanese or Chinese) then each character needs two bytes. If you are using UTF8 encoding (also called unicode support) then a character can use between 1 and 3 bytes, depending on the character.