BookmarkSubscribeRSS Feed
Sukhi1
Calcite | Level 5

Hi Below is the excerpt from log which I am getting . please me to remove this warning.

 

WARNING: 4 variables have conflicting attributes in the two data sets.

 
    Listing of Common Variables with Differing Attributes

 Variable       Dataset      Type  Length  Format   Informat

 LBL_ID         WORK.LIBPRD  Char      80  $80.
                WORK.LIBNEW  Char      80  $80.
 LBL_NAME       WORK.LIBPRD  Char      80  $80.
                WORK.LIBNEW  Char      80  $80.
 DBETYBRCON_BK  WORK.LIBPRD  Num        8  BEST12.  BEST32.
                WORK.LIBNEW  Num        8
 LBL_COMMENT    WORK.LIBPRD  Char      80  $80.
                WORK.LIBNEW  Char      80  $80.

13 REPLIES 13
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You get rid of warnings/errors by fixing you code or data.   In this case fix your data to not have conflicting attributes and the warning will go away.  This one:

DBETYBRCON_BK  WORK.LIBPRD  Num        8  BEST12.  BEST32.

Clearly shows it has a format and informat on one dataset, and not on the other, that is a difference.  I suspect the others differ in label, but as that is not shown, I can't be sure.

 

The alternative is to remove the whole metadata compare part, its one of the options, which you can find a whole list and examples of in the SAS help docs:

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n0c1y14wyd3u7yn1dmfcp...

Sukhi1
Calcite | Level 5
Hello
I have used
DBETYBRCON_BK = input(DBETYBRCON_BK1, ?? best32.);
in data step.
also I have a meta data in which I have defined
%LET DBETYBRCON_BK = DBETYBRCON_BK LENGTH=8. FORMAT=best12. ;
%LET iDBETYBRCON_BK = INFORMAT DBETYBRCON_BK best32. ;
%LET DBETYBRCON_BK1 = DBETYBRCON_BK1 FORMAT=$80.;
%LET iDBETYBRCON_BK1 = INFORMAT DBETYBRCON_BK1 $80.;

so I am unable to find why warning is coming
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, not sure what I can add.  Look at a proc contents of each of the dataset you will clearly see differences in the output.

 

"I have used
DBETYBRCON_BK = input(DBETYBRCON_BK1, ?? best32.);"

 

Firstly, avoid coding in upper case, no need to shout.  This tells me nothing, there is no attributation of the variable dbetybrcon_bk, it doesn't matter that you are reading in the data using an infomat,what is important is what the variable is created as what metadata is assigned.

 

"%LET DBETYBRCON_BK = DBETYBRCON_BK LENGTH=8. FORMAT=best12. ;
%LET iDBETYBRCON_BK = INFORMAT DBETYBRCON_BK best32. ;
%LET DBETYBRCON_BK1 = DBETYBRCON_BK1 FORMAT=$80.;
%LET iDBETYBRCON_BK1 = INFORMAT DBETYBRCON_BK1 $80.;"

Why?  Put data information in datasteps, macro is not a replacement for Base SAS!!! 

Even with that, you make no mention of label on any of those variables, for dbettbrcon_bk there is no informat attribute, for the i version, there is no length or format etc.

 

How to create a dataset:

data want;
  length dbetybrcon 8 ...;
  format dbetybrcon best12. ...;
  informat dbetybrcon best32. ...;
  label dbetybrcon "something" ...;
run;

Or you can blank all variables parts by:

data want;
  set want;
  format _all_;
  informat _all_;
run;

 

Sukhi1
Calcite | Level 5
there is no label for DBETYBRCON_BK here. but for the other variable there are label. Yes I have used macro and inside macro i have called that meta variable . does attributes of the variable change when we assign some value to them ?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Please show your exact code.  Variables are defined once, if they do not have a specific attribute then the default is used.  You can change these later on.  Do a proc datasets on each of the datasets, you will see what the differences are.

Again, I really recommend you don't put SAS code in macro variables, you are opening a whole host of problems for yourself.

Kurt_Bremser
Super User

@Sukhi1 wrote:
there is no label for DBETYBRCON_BK here. but for the other variable there are label. Yes I have used macro and inside macro i have called that meta variable . does attributes of the variable change when we assign some value to them ?


Attributes of an existing variable do not change. Attributes of a new variable are set according to the values assigned to it.

Sukhi1
Calcite | Level 5
DBETYBRCON_BK = input(DBETYBRCON_BK1, ?? best32.);"
So in this case new variable is DBETYBRCON_BK . right I wanted to have it attributes retained. after assignment.
Kurt_Bremser
Super User

@Sukhi1 wrote:
DBETYBRCON_BK = input(DBETYBRCON_BK1, ?? best32.);"
So in this case new variable is DBETYBRCON_BK . right I wanted to have it attributes retained. after assignment.

Which is of course impossible because DBETYBRCON_BK1 is of type character and DBETYBRCON_BK is numeric.

Sukhi1
Calcite | Level 5
I have defined the format for the above field like this .
%LET DBETYBRCON_BK = DBETYBRCON_BK LENGTH=8. FORMAT=best12. ;
%LET iDBETYBRCON_BK = INFORMAT DBETYBRCON_BK best32. ;

now after assignment. that is after this line
DBETYBRCON_BK = input(DBETYBRCON_BK1, ?? best32.);"
it is getting something like this (proc compare)
DBETYBRCON_BK WORK.LIBPRD Num 8 BEST12. BEST32.
WORK.LIBNEW Num 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

This,

"%LET DBETYBRCON_BK = DBETYBRCON_BK LENGTH=8. FORMAT=best12. ;"

Does not define anything.  It creates a macro variable containing the text "%LET DBETYBRCON_BK = DBETYBRCON_BK LENGTH=8. FORMAT=best12. ;".  

 

Also, in that string you do not specify an informat.  However with the code:

DBETYBRCON_BK = input(DBETYBRCON_BK1, ?? best32.);"

 

you are reading data in with an informat - best32.

 

As I mentioned above if you want to remove all of a certain property (we often remove all informats from a dataset);

data want;
  set have;
  informat _all_;
run;

Again, avoid shouting code, and using macro where it is not needed.

Sukhi1
Calcite | Level 5
thanks I will remove all the format and informat for the time being.
Kurt_Bremser
Super User

The %let does exactly NOTHING in itself, it just creates a macro variable for further use.

Unless you use it later in an attrib statement or as part of a SQL select, it's just waste of screen space.

 

And once again: a numeric variable CANNOT have the attributes of a character variable. PERIOD.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 13 replies
  • 8136 views
  • 0 likes
  • 3 in conversation