Hi everyone - a bit newer to SAS and running into a problem trying to adapt someone's older code.
Essentially I have a character variable with responses, and am coding in skips to it.
Then I create a "label" using the proc format function with value to label the skip and keep responses
I checked proc contents, and it is still showing format and informat still remaining at the same length.
Any help appreciated
If you don't define a DEFAULT width for the format then PROC FORMAT will GUESS that you wanted the default to be the maximum width of all of the display values you mentioned when defining the format.
You can specify the width when you use the format.
format OPENTEXT $OPENTEXT20.;
Note that if you don't specify the maximum width it will default to 40 , unless the longest label width is more than 40.
Say your variable named OPENTEXT has a length of 80 then you when you define the format you will want to set the maximum width to at least 80. But you might want to set the default to something shorter.
Note that character format names start with a $.
proc format;
value $OPENTEXT (default=40 max=80)
'777'="Skip"
;
run;
If you don't define a DEFAULT width for the format then PROC FORMAT will GUESS that you wanted the default to be the maximum width of all of the display values you mentioned when defining the format.
You can specify the width when you use the format.
format OPENTEXT $OPENTEXT20.;
Note that if you don't specify the maximum width it will default to 40 , unless the longest label width is more than 40.
Say your variable named OPENTEXT has a length of 80 then you when you define the format you will want to set the maximum width to at least 80. But you might want to set the default to something shorter.
Note that character format names start with a $.
proc format;
value $OPENTEXT (default=40 max=80)
'777'="Skip"
;
run;
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.