BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9

How many bytes does the variable Q20 in the PDV?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@tianerhu wrote:

let suppose the Q20 is character variable .


Run Proc Contents on the data set, look at the LENGTH for the variable.

View solution in original post

8 REPLIES 8
SASKiwi
PROC Star

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.  

tianerhu
Pyrite | Level 9

let suppose the Q20 is character variable .

ballardw
Super User

@tianerhu wrote:

let suppose the Q20 is character variable .


Run Proc Contents on the data set, look at the LENGTH for the variable.

SASKiwi
PROC Star

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.

tianerhu
Pyrite | Level 9

Thank you for your help.

Tom
Super User Tom
Super User

@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.

tianerhu
Pyrite | Level 9

Thank you for your help.

SASKiwi
PROC Star

@tianerhu  - If you are happy with the responses to your post please mark the best response as answering your question.

SAS Innovate 2025: Register Now

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1324 views
  • 5 likes
  • 4 in conversation