
SAS Clinical Solutions
Let's continue SAS Clinical Solutions with SAS log's ERROR, Warning and Notes handling. We show in previous blog about ERRORS and now, let's discuss on WARNINGS and NOTES
*********************WARNING************************;
a. WARNING: Multiple lengths were specified for the variable state by input data set(s). This may cause truncation of data.
1. Assign length statement before the set statement.
2. You can also use - options VARLENCHK=NOWARN|WARN; to suppress/show warning oflength massages.
3. You can also use dictionary table to assign maximum length. But, I think, 1st solution is simple and easy to use.
b. WARNING: Length of character variable Hello has already been set. Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable.
c. WARNING: Apparent symbolic reference NAME not resolved.
Assign length statement before set as above.
Please make sure that macro variable NAME is created before its call in session. If you are working on some program where it is not possible to make sure (calling standard macro), then you can use this options:
To suppress warning massage OPTIONS NOSERROR; *For Macro Variable;
d. WARNING: Apparent invocation of macro TEST not resolved.Please make sure that macro TEST is created before its call. If you are working on someprogram where it is not possible to make sure (calling standard macro), then you can use these
<options:
To suppress warning massage OPTIONS NOMERROR;*For Macro definition;
e. WARNING: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation marks
OPTIONS NOQUOTELENMAX;
f. WARNING: No output destinations active.
Activate any of the ODS destination. Run following code,
ODS LISTING;
g. WARNING: ... truncation of data.There are various warning massages related to truncation. However, all can be handled by adjusting length by assigning length statement before set statement (as above mentioned).
h. WARNING: This CREATE TABLE statement recursively references the target table.A consequence of this is a possible data integrity problem.This warning shows up when you create same named dataset from same name dataset in one
PROC SQL step. Just change the name of new dataset.
*******************NOTES and INFO*********************;
a. NOTE: Variable TEST is uninitialized.
This is very common NOTE, which needs to pay attention. (SAS Clinical Solutions) SAS Log shows this NOTE when data
step processing encounters a variable referenced but that variable is not present in INPUT
dataset nor created before it is being referenced.
For example,
Data final;
Set DM (Keep=USUBJID AGE SEX);
Test = Sexx;*Sexx is not in INPUT Dataset DM nor it is created before;
Run;
So, please make sure that the variable is
? correctly spelled or
? it is present in INPUT dataset (make sure you don’t drop it with Keep/drop
options in set statement if the variable is present in original main dataset) or
? Created in data step
b. NOTE: MERGE statement has more than one data set with repeats of by values
1. Do you expect more than one value with BY GROUP in 2 datasets?
2. If no, then, you need to look at previous code. Most of the time, in clinical data,
programmers encounter only 1 dataset with Repeats of records in given BY GROUP. So, please
check.
=====>> If the input datasets are correct, then increase BY GROUP variable list. For example, if
BY USUBJID LBTESTCD has repeats of records then try with BY USUBJID LBTESTCD VISIT.
3. If yes, then you should not use DATA step for merging. Use PROC SQL to create Cartesian
product of all combination from more than 1 dataset.
Look at given line 727 in log, column 8 position, you may find name of variable/expression
which is used in SUBSTR. The variable/macro variable passes value other than numeric like
character string, so, please make sure and correct it.
c. NOTE: Invalid third argument to function SUBSTR at line 728 column 8
d. Unable to open SASUSER.REGSTRY. WORK.REGSTRY will be opened instead
1. If you are running SAS in UNIX in batch mode, use this command —
sas -rsasuser test.sas To run SAS file in UNIX batch mode
sas —rsasuser & To invoke SAS in UNIX
2. You can make changes to configure file and set -RSASUSER option in configuration file also.
But, contact administrator before this changes.
e. NOTE: Missing values were generated as a result of performing an operation on
missing values. Each place is given by: (Number of times) at
(Line):(Column). 1 at 3:6
If some of the variables’ values are missing when running arithmetic operation on those
variables, missing values are generated. So, use the following conditional logic to skip the
processing of missing variable records.
Data test1;
set test;
If test ne . then value=test+1;
run;
f. NOTE: Character values have been converted to numeric values at the places
given by: (Line):(Column). 1048:3
g. NOTE: Numeric values have been converted to character values at the places
given by: (Line):(Column). 1056:
At give line and columns, you’ll see variable which is getting converted from numeric to
character OR Character to Numeric automatically.
So, to avoid this NOTES, use following functions:
PUT: To convert to Character
INPUT: To convert to Numeric
In Data step, you may have reference character variable as numeric. So, SAS try to perform
operation on variable considering the variable numeric. So, when it encounters character value,
it throw NOTES of Invalid numeric data.
For example,
h. NOTE: Invalid numeric data,...
Data a;
A='Hello';
If a ne . then B=1;* variable a is character but makes comparison
as numeric (.) in if condition by using comparison operator;
Run;
i. INFO: The variable col1 on data set WORK.FN3 will be overwritten by data set
WORK.FN
When DOING merging, please make sure to you know there is OVERWRITTEN of variable. And,
if it affects output, please correct it by renaming variable or dropping it.
j. NOTE: At least one W.D format was too small for the number to be printed. The
decimal may be shifted by the "BEST" format.
1. Please correct the format you are using. This happen because some of the data values has
more digits to print than your format.
E.g.
Data _Null_;
a=12345678;
Format a 8.2 ;
put a 8.2 ;
run;
a=12345678 ----> Format used: 8.2 then value of variable, a, has 8 digit to print before decimal
(8), one character for dot of decimal (1) and 2 place after decimal (2). So, you have to use at
least, 8+1+2=11 character, 11.2 if you want at least 2 decimals.
2. Change the values from lower unit to higher unit: For example, convert your value 12345678
to 12.35 Million value.
k. INFO: Character variables have defaulted to a length of 200 at the places given
by: (Line):(Column). Truncation may result.
This type of INFO comes when some character functions (like SCAN, COALESCEC, TRANWRD
etc.) are applied and length of newly created variable is not assigned. This is SAS ’s default
nature of avoiding truncation by assigning 200 length when functions like SCAN, COALESCEC,
TRANWRD used. When this functions are used, newly created value may have more length then
original. So, assign appropriate length to newly created variable using length statement.
l. NOTE: Division by zero detected at line 102 column 4.
AND
m. NOTE: Mathematical operations could not be performed at the following places.
The results of the operations have been set to missing values. Each place is given
by: (Number of times) at (Line):(Column). 2 at 164:4
At given line and column, if you see you would find a variable/expression which would be
resolved to zero, 0, for at least one iteration (one observation). This is mathematically incorrect.
So, SAS sets its value to be MISSING.
Data a;
input a b;
c=a/b;*value of b for 2nd and 3rd observation is ZERO, 0;
Cards;
10 12
13 0
11 0
;
Can be resolved this by conditional programming
Data a;
input a b;
if 0
else c=.;
Cards;
10 12
13 0
11 0
;
**********************MAGIC CODE*************************;
Sometime when you are working and your SAS session has stopped processing submitted SAS
statements and consider all the statements as comments, then try running following code ONE
AFTER ANOTHER:
;*';*";*/;
;*';*";*/;quit;%mend;
*'; *"; *); */; %mend; run;
********* Useful options related to SAS Log ********;
/*-- Thanks you very much--*/
Reference:
http://support.sas.com
About Rang Technologies:
Headquartered in New Jersey, Rang Technologies has dedicated over a decade delivering innovative solutions and best talent to help businesses get the most out of the latest technologies in their digital transformation journey. Read More...