Date: Sun, 10 Aug 2008 19:06:09 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: RES: numeric fields, where is the diference
Content-Type: text/plain; charset=ISO-8859-1
Adriano,
I'm sure there are better ways to do it, but would something like the
following serve your current need?:
data a;*master data;
input id base;
datalines;
1 2
2 2
3 4
4 5
5 1932
6 21
;
data b;*received data;
input id find;
datalines;
1 2
3 4
4 5
5 2932
6 21
;
proc sort data=a;
by id;
run;
proc sort data=b;
by id;
run;
data combine;
merge a b (IN=INB);
by id;
IF INB;
run;
data enderror;
length basetoprint findtoprint $200;
format basetoprint findtoprint $200.;
set combine;
error=base-find;
basetext=input(base,$20.);
findtext=input(find,$20.);
call missing (basetoprint);
call missing (findtoprint);
do i=1 to max(length(basetext),length(findtext));
if substrn(basetext,i,1) ne substrn(findtext,i,1) then do;
basetoprint=catt(basetoprint,"^S={font_weight=bold}",
substr(basetext,i,1));
findtoprint=catt(findtoprint,"^S={font_weight=bold}",
substr(findtext,i,1));
end;
else do;
basetoprint=catt(basetoprint,"^S={font_weight=medium}",
substr(basetext,i,1));
findtoprint=catt(findtoprint,"^S={font_weight=medium}",
substr(findtext,i,1));
end;
end;
RUN;
ods rtf file="c:\errors.rtf";
ODS ESCAPECHAR = "^";
proc print;
var id basetoprint findtoprint error;
where error^=0;
run;
ODS RTF CLOSE;
HTH,
Art
----------
On Sun, 10 Aug 2008 08:00:35 -0700, Adriano Rodrigues <adriano@GPP.COM.BR>
wrote:
>Hi Howard,
>
>Yes, traffic lighting, i need figure out how to show where exatcly is the
>error for me, I need highlight or bold the exact character, think isn?t so
>easy, not found example on this yet. Thanks anyway.
>
>Adriano
>
>-----Mensagem original-----
>De: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] Em nome de Howard
>Schreier <hs AT dc-sug DOT org>
>Enviada em: sᢡdo, 9 de agosto de 2008 09:41
>Para: SAS-L@LISTSERV.UGA.EDU
>Assunto: Re: numeric fields, where is the diference
>
>It appears you are looking for a technique commonly called "traffic
>lighting". Lots of papers have been done on the subject.
>
>On Fri, 8 Aug 2008 15:38:19 -0700, Adriano Rodrigues <adriano@GPP.COM.BR>
>wrote:
>
>>Hi all,
>>
>>
>>
>>I have 2 databases, one master with all Ids and one variable to show me
>some
>>information, and one new data, who is from another source. I want check
if
>>variable find=base for same id.
>>
>>All this is ok with this code:
>>
>>
>>
>>data a;*master data;
>>
>>input id base;
>>
>>datalines;
>>
>>1 2
>>
>>2 2
>>
>>3 4
>>
>>4 5
>>
>>5 1932
>>
>>6 21
>>
>>;
>>
>>run;
>>
>>
>>
>>
>>
>>data b;*received data;
>>
>>input id find;
>>
>>datalines;
>>
>>1 2
>>
>>3 4
>>
>>4 5
>>
>>5 2932
>>
>>6 21
>>
>>;
>>
>>run;
>>
>>
>>
>>proc sort data=a;
>>
>>by id;
>>
>>run;
>>
>>
>>
>>proc sort data=b;
>>
>>by id;
>>
>>run;
>>
>>
>>
>>data combine;
>>
>>merge a b (IN=INB);
>>
>>by id;
>>
>>IF INB;
>>
>>RUN;
>>
>>
>>
>>data enderror;
>>
>>set combine;
>>
>>error=base-find;
>>
>>proc print;
>>
>>var id base find error;
>>
>>where error^=0;
>>
>>run;
>>
>>
>>
>>output:
>>
>>
>>
>>Obs id base find error
>>
>>
>>
>>4 5 1932 2932 -1000
>>
>>
>>
>>Desired output would be bold error, or other font for the where is error,
>>the 2 could be italic? (from 2932) I need this because my real data have
>>numbers with 8-9 digits to 13-14 digits. Here I see fast the error is 2
to
>1
>>to change, but when many numbers this come more hard to find.
>>
>>
>>
>>Well, if anyone has one suggestion to improve this, I am here to learn,
>many
>>thanks.
>>
>>
>>
>>Observation: this data come from other sources where I cant actually
>>automatic make any correction, who send have to correct manually and send
>>back to me and I will send report where are the errors
>>
>>
>>
>>Adriano
|