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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 8 replies
  • 1147 views
  • 5 likes
  • 4 in conversation