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;
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!
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.