How many bytes does the variable Q20 in the PDV?
@tianerhu wrote:
let suppose the Q20 is character variable .
Run Proc Contents on the data set, look at the LENGTH for the variable.
Your question is incomplete so is impossible to answer. If Q20 is a numeric variable then the default storage amount is 8 bytes. If it is character then it would depend on the number of characters being assigned to it. For example this statement - Q20 = 'ABC'; - will create the variable with a length of 3 characters or 3 bytes.
let suppose the Q20 is character variable .
@tianerhu wrote:
let suppose the Q20 is character variable .
Run Proc Contents on the data set, look at the LENGTH for the variable.
The number of bytes used by a character variable in the PDV will be the same as on disk. As @ballardw suggests PROC CONTENTS will give you the length in characters and that is usually is also the number of bytes.
Thank you for your help.
@SASKiwi wrote:
The number of bytes used by a character variable in the PDV will be the same as on disk. As @ballardw suggests PROC CONTENTS will give you the length in characters and that is usually is also the number of bytes.
PROC CONTENTS will give you the length in characters bytes and that is usually is also the number of bytes characters.
Thank you for your help.
@tianerhu - If you are happy with the responses to your post please mark the best response as answering your question.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.