BookmarkSubscribeRSS Feed
Prakash_K
Calcite | Level 5

Hi All,

 

We are using SAS 9.4 and how to get rid of warnings in sas log only below kind of error occurs (like different length...) is that any options we can set in code to ignore only these kind of warnings.

 

I have changed the data file length as 30 and its worked but don't want to do that.. is that any other way is there.. please suggest ASAP.

 

NOTE: Appending WORK.TEMP_CPASTPX450_SURR_PACK to STGIV2.STG_CPASTPX450_SURR_PACK.
WARNING: Variable TEL_NO has different lengths on BASE and DATA files (BASE 30 DATA 20).

3 REPLIES 3
Tom
Super User Tom
Super User

The easiest way is to create the original datasets using the right length to begin with.

 

Why do the dataset have different lengths for the same variable?

 

If you really cannot fix the original dataset then use a view.

data for_append / view=for_append;
  length TEL_NO $30;
  set TEMP_CPASTPX450_SURR_PACK;
run;

proc append data=for_append base=STGIV2.STG_CPASTPX450_SURR_PACK 
  force;
run;

proc delete data=for_append (mtype=view) ;
run;

 

Prakash_K
Calcite | Level 5

Hi Tom

 

Thanks for your reply... 

 

Its a kind of migration from netezza database to Db2cloud...

 

Actually we are extracting the data from another source and load into DB2cloud ... in netezza the same extraction from source and load to netezza not giving any warnings. But the same code giving warnings in DB2cloud.. Instead of defining length, is there anyother way to avoid warning in sas log for that particular kind of warnings and not other warnings..

 

Code change length fix,  could think of final options.. but before that any other way is there to get rid of such warnings?

 

Thanks in advance...

 

 

Tom
Super User Tom
Super User

There is not an option that effects warning from PROC APPEND. 

But there is one that effect warnings from data steps. VARLENCHK.

options VARLENCHK=NOWARN;
data x;
  length string $20;
  set new;
run;

In general for this type of transfer you probably need to know how the variables should be defined.  You might be able to reference the target dataset to get the proper metadata instead of writing explicit LENGTH statements. 

So if you were appending SRC.SOURCE to DEST.TARGET you might add a view in the middle.

Like this:

options VARLENCHK=NOWARN;
data temp / view=temp;
  if 0 then set dest.target ;
  set src.source;
run;

proc append base=dest.target data=temp force;
run;

You might also try using PROC FEDSQL if you are really moving from one external database to another.  It is basically designed for that type of activity, but it is not something I have used.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 3 replies
  • 2809 views
  • 0 likes
  • 2 in conversation