Desktop productivity for business analysts and programmers

Warning message - Variable length

Reply
N/A
Posts: 0

Warning message - Variable length

Hi: I get this warning message when I attempt to change a variable length. Any idea how to get rid off this message?

data stdlabnames;
148 length standard_lab_type $25 standard_lab_name $50 lbtestid $30;
149 format _all_; informat _all_;
150
151 set rawdata.standard_lab_names;
NOTE: Data file RAWDATA.STANDARD_LAB_NAMES.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used, which might
require additional CPU resources and might reduce performance.
The SAS System

152
153 keep standard_lab_type standard_lab_name lbtestid restype;
154
155 run;

WARNING: Multiple lengths were specified for the variable STANDARD_LAB_TYPE by input data set(s). This may
cause truncation of data.
WARNING: Multiple lengths were specified for the variable STANDARD_LAB_NAME by input data set(s). This may
cause truncation of data.
WARNING: Multiple lengths were specified for the variable LBTESTID by input data set(s). This may cause
truncation of data.
Respected Advisor
Posts: 4,137

Re: Warning message - Variable length

Hi

SAS nicely tells you that your new variable lengths are shorter than the ones in the source data set. So the warning as such is appropriate.

I wouldn't now how to suppress such a warning - but you could of course change the lengths in a post processing step, i.e.

data stdlabnames;
format _all_; informat _all_;
set rawdata.standard_lab_names (keep=standard_lab_type standard_lab_name lbtestid restype);
run;

proc sql;
alter table stdlabnames
modify
standard_lab_type char(25)
,standard_lab_name char(50)
,lbtestid char(30)
;
quit;

Another way would be to just rename the variables when you read them (a rename as part of the set statement) and then define the output vars the way you want them and assign the renamed vars to the output vars.


HTH
Patrick

Message was edited by: Patrick Message was edited by: Patrick
Super Contributor
Posts: 356

Re: Warning message - Variable length

There is an option that globally turns this warning off, can't remember of the top of my head the exact syntax... try searching SAS site for "Length & Warning"

Barry
Occasional Contributor
Posts: 6

Re: Warning message - Variable length

Hi,

You can try this system option to turn off warning message.
options varlenchk=nowarn;
Occasional Contributor
Posts: 6

Re: Warning message - Variable length

Hi,

You can try this system option to turn off warning message.
options varlenchk=nowarn;
N/A
Posts: 0

Re: Warning message - Variable length

Thank you all.
Ask a Question
Discussion stats
  • 5 replies
  • 185 views
  • 0 likes
  • 4 in conversation