Help using Base SAS procedures

Formats

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
Accepted Solution

Formats


Hi,

I have a column (code)which has a length 255

                                             format $255

                                            informat$255

I change its length to 7

When i run a PROC REPORT WITH OUTPUT STATEMENT

I get the following error???

ERROR: The width of Code is not between 1 and 213. Adjust the column width or line size.

NOTE: This affects LISTING output.

Could you help me figure out how to proceed

Thanks


Accepted Solutions
Solution
‎08-29-2013 07:46 PM
Super User
Super User
Posts: 6,681

Re: Formats

You didn't change the FORMAT.  Try this example to see the same error message.

proc report data=sashelp.class nofs;

format name $255.;

run;

SAS has a nasty habit of attaching $xxx. formats to characters variables especially when using PROC IMPORT or SAS/Access.  You can remove them with a format statement that lists variables but does NOT specify any format.

format _character_ ;

View solution in original post


All Replies
Super Contributor
Posts: 358

Re: Formats

Turn off the LISTING and the error goes away.

ODS LISTING CLOSE.

Super User
Posts: 10,816

Re: Formats

I suspect that you didn't actually manage to change the length as you think and your current LINESIZE system option isn't large enough to accomodate the variable Code.

You may be able to get the output using

options linesize=max;

OR in the proc use Format Code $7.; That should display the first 7 characters of the variable.

Run proc contents on the dataset containing the variable to verify the actual length.

Solution
‎08-29-2013 07:46 PM
Super User
Super User
Posts: 6,681

Re: Formats

You didn't change the FORMAT.  Try this example to see the same error message.

proc report data=sashelp.class nofs;

format name $255.;

run;

SAS has a nasty habit of attaching $xxx. formats to characters variables especially when using PROC IMPORT or SAS/Access.  You can remove them with a format statement that lists variables but does NOT specify any format.

format _character_ ;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 516 views
  • 3 likes
  • 4 in conversation