Hello all,
I have two Data Bases that store a field room, one has it with leading zeros and one without, the hitch is these rooms can have a alpha charater? any ideas?
I had some 1100 false positives now with this just a 100 or so
I came up with this:
put(input(a.room,best4.),z4.) <> put(input(b.room,best4.),z4.)
I started with:
a.room <> b.room
but with data like:
a.room b.room
451a 0451a
451b 0451b
1 00001
21 00021
1-1 001-1
I am not sure what to try to get them down to the true diffences that I want. TIA -KJ
PRX functions can be handy,
data have;
input aroom$ broom$;
_b=prxchange('s/(^0*)([^0]+.+)/$2/o',-1,broom);
equal_or_not=ifc(aroom=_b,'Y','N');
cards;
451a 0451a
451b 0451b
1 00001
21 00021
1-1 001-1
451a 0451c
;
PRX functions can be handy,
data have;
input aroom$ broom$;
_b=prxchange('s/(^0*)([^0]+.+)/$2/o',-1,broom);
equal_or_not=ifc(aroom=_b,'Y','N');
cards;
451a 0451a
451b 0451b
1 00001
21 00021
1-1 001-1
451a 0451c
;
data have; input aroom$ broom$; equal_or_not=(aroom=prxchange('s/^0+//',-1,broom)); cards; 451a 0451a 451b 0451b 1 00001 21 00021 1-1 001-1 451a 0451c ; run;
Just a check, but You know that <> is max in SAS?
In most languages it means Not Equals and from your usage it looks like that's what your using it for?
The MIN and MAX operators are used to find the minimum or maximum value of two quantities. Surround the operators with the two quantities whose minimum or maximum value you want to know. The MIN (><) operator returns the lower of the two values. The MAX (<>) operator returns the higher of the two values.
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm
Yes I am aware that <> is max, but in "proc sql" it works and works with SQL queries diectly thus we use it... I have been burned by it in data steps so it is playing a bit with fire.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.