BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
cosmid
Lapis Lazuli | Level 10

Hi,

 

Example, if you have the following format:

proc format
  value $test 
    'a' = 'Access'
    'd' = 'Decline';
run;

format example $test.;

This will provide the format name $test with a width of 6. If there is a value in the var example such as 'abcdefgh', then it'll be displayed as 'abcdef' and 'gh' will be truncated. How do you set the width of $test or did I misunderstand PROC FORMAT completely when it comes to width?

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Optional argument on the VALUE statement :

DEFAULT=length

specifies the default length of the format.
The value for DEFAULT= becomes the length of the format if you do not give a specific length when you associate the format with a variable.

Default The length of the longest label that is assigned to the right of the equal sign
Range 1–32767
Tip As a best practice, always specify the DEFAULT= option if you specify a format as a label.

 

Koen

View solution in original post

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Optional argument on the VALUE statement :

DEFAULT=length

specifies the default length of the format.
The value for DEFAULT= becomes the length of the format if you do not give a specific length when you associate the format with a variable.

Default The length of the longest label that is assigned to the right of the equal sign
Range 1–32767
Tip As a best practice, always specify the DEFAULT= option if you specify a format as a label.

 

Koen

cosmid
Lapis Lazuli | Level 10
Thank you Koen!

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 535 views
  • 1 like
  • 2 in conversation