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.
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:
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;
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.
@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 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.
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.