Hello
I'm started using the (very powerful) PROC COMPARE.
I'd like to generate a summary output and briefsummary does it nicely; however I would like to remove the WARNING and NOTE appearing at the very beginning of the output (in the yellow box on the screenshot).
Is this possible?
Many thanks
I think you need to present the code you are using (and possibly some sample data, as datastep code). Otherwise it is not obvious what you are doing.
No. These WARNINGs are there for a reason, alerting you to data that might make your compare incorrect. To get rid of the WARNINGs, either get rid of the duplicate observations, or find an additional ID variable that makes the compares unique.
Thanks @Kurt_Bremser
all I needed is to know whether there are duplicates, which option briefsummary does. I wouldn't need to know at which observation the duplications occur ; but from what you say this info cannot be excluded from the result.
thanks
Perhaps you could use PROC SORT to find dups.
447 proc sort data=sashelp.class out=dups uniout=uni nouniquekey;
448 by sex age;
449 run;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: 4 observations with unique key values were deleted.
NOTE: The data set WORK.DUPS has 15 observations and 5 variables.
NOTE: The data set WORK.UNI has 4 observations and 5 variables.
duplicates
Hi @data_null__
Thanks for your suggestion,
Actually I would need a few more info than the dups (I know, that's contrary to what I originally said!!).
Basically I'd like to use a few options from PROC COMPARE (i.e. listing all variables where there is a difference), but without the initial WARNINGs and MESSAGEs (it's just cosmetic, but it may confuse the users of the report).
thanks
thanks
(I'm trying to create a high level report with )
Use PROC PRINTTO to "capture" the default BRIEF report and edit it into the REPORT you need.
@MART1 wrote:
Hi @data_null__
Thanks for your suggestion,
Actually I would need a few more info than the dups (I know, that's contrary to what I originally said!!).
Basically I'd like to use a few options from PROC COMPARE (i.e. listing all variables where there is a difference), but without the initial WARNINGs and MESSAGEs (it's just cosmetic, but it may confuse the users of the report).
thanks
thanks
(I'm trying to create a high level report with )
Hi @data_null__
I can't find the way to select the outputs from PROC COMPARE to add to PROC PRINT (never used PROC PRINT before unfortunately).
Below is an example with dummy data:
data WORK.TABLE_A; input DAY VAL1 VAL2; datalines; 20190106 2 452 20190107 5 658 20190108 2 743 20190109 8 44 20190202 9 698 20190202 9 698 ; run; data WORK.TABLE_B; input DAY VAL1 VAL2; datalines; 20190106 2 58 20190107 5 658 20190108 2 12 20190109 8 44 20190202 9 698 20190202 9 698 ; run; title "Test"; PROC COMPARE BASE = TABLE_A COMPARE= TABLE_B briefsummary ; ID DAY; RUN;
(so using PROC PRINT, I'd like to display the 2nd and 3rd boxes, not the one crossed out)
could you please give me an example of how to do this?
many thanks
PROC PRINTTO
@MART1 wrote:
Hi @data_null__
I can't find the way to select the outputs from PROC COMPARE to add to PROC PRINT (never used PROC PRINT before unfortunately).
Below is an example with dummy data:
data WORK.TABLE_A; input DAY VAL1 VAL2; datalines; 20190106 2 452 20190107 5 658 20190108 2 743 20190109 8 44 20190202 9 698 20190202 9 698 ; run; data WORK.TABLE_B; input DAY VAL1 VAL2; datalines; 20190106 2 58 20190107 5 658 20190108 2 12 20190109 8 44 20190202 9 698 20190202 9 698 ; run; title "Test"; PROC COMPARE BASE = TABLE_A COMPARE= TABLE_B briefsummary ; ID DAY; RUN;(so using PROC PRINT, I'd like to display the 2nd and 3rd boxes, not the one crossed out)
could you please give me an example of how to do this?
many thanks
If you are simply wanting to compare record by record (1 with 1, 2 with 2 etc) between File A and File B, then you can drop the ID statement and that will get rid of your warnings.
Hi @SASKiwi
I'd like to have the ID in (which is the primary key in my datasets), to see which ones have different variable's values between datasets.
Without ID, it shows the Obs number (example below), but the users of the reports would rather see the IDs.
thanks
@MART1 - Having an ID statement where the ID variable is not unique on both BASE and COMPARE datasets could lead to erroneous comparisons. That is the whole point of the SAS log warnings. An alternative approach might be to add a "counter" variable to your data that might look like this:
Day Counter 1 1 1 2 2 1 2 2 2 3
A combination of both Day and Counter will form a unique key for your data. Then when you do your COMPARE, your ID statement will be: ID Day Counter;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.