Dear All,
Can some one help me with below issue.
I comparing the around 100 datasets in the two libraries by using the Proc compare. 98% of datasets have similar attributes and are identical. when i am running proc compare by having 100 datasets in the 'Do LOOP'. I am getting huge report as there 98% of datasets have been compared..."I would like to see in the output only thoose datasets which have unequal values."I have used the option OUTNOEQUAL but it is meant for outputting to Datasets....
Thanks
Rakesh
I'm not quite understanding what you are looking for. Are you saying you want to run PROC COMPARE, and have it produce NO output if the two datasets match? For that, you might consider a macro solution that is something like:
1. Turn off wrting of output (with proc printto/ ODS Close etc).
2. Run PROC COMPARE
3. Check the value of PROC COMPARE macro variable holding return code, SYSINFO.
4. If SYSINFO is non-zero (so datasets did not match), turn on writing of the output and run PROC COMPARE again.
There is a lot on information in SYSINFO that allows you to identify what differences were encountered.
Proc compare is ok. Personally if I was doing any major comparisons like that I wouold write the code myself to exactly output the results I want. If you use SQL you can use the except function:
proc sql; create table LEFT as select * from BASE except select * from COMP; create table RIGHT as select * from COMP except select * from BASE; quit;
That will give you the differences betwen the datasets both ways. You can advance that in many ways of course using merging and such like.
You mention that you create a data set with OUTNOEQUAL. Is the contents of that data set what you would like to see (without having to view the rest of the output)?
It's easy enough to print a SAS data set. PROC PRINT would do it (perhaps with a VAR statement to control which variables print). There are two further tasks required. First, put a title on the PROC PRINT so you can tell which data sets are being compared. Second, use PROC PRINTTO to move the output to another file that you specify:
proc printto print='some other file';
run;
proc print;
run;
proc printto;
run;
The final PROC PRINTTO makes sure that the rest of the output that you don't want to see goes to the .lst file.
Hi,
I was able to create a dataset and use the proc print option but would like to know if we have an option to suppress the output for only Unequal values. in that way the default proc compare listing remains intact.
There are a ton of options available on the PROC COMPARE statement. You may need to play with them to figure out which does what you want. A couple of possibilities
BRIEF
NOVALUES
Look through the documentation and see what looks promising.
I'm not quite understanding what you are looking for. Are you saying you want to run PROC COMPARE, and have it produce NO output if the two datasets match? For that, you might consider a macro solution that is something like:
1. Turn off wrting of output (with proc printto/ ODS Close etc).
2. Run PROC COMPARE
3. Check the value of PROC COMPARE macro variable holding return code, SYSINFO.
4. If SYSINFO is non-zero (so datasets did not match), turn on writing of the output and run PROC COMPARE again.
There is a lot on information in SYSINFO that allows you to identify what differences were encountered.
Perfect sir...Thank you..
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: