Rust

While I was photographing the ruins of the Elkins Roundhouse, I saw some rust on the big turnstile. Actually, I saw a lot of rust on everything, but the point is, I really started looking at the rust. It was beautiful. It was all variations of colors and textures. It was peeling paint cracking and folding and turning up to reveal other layers of paint, all being pushed away from the metal by the rust forming. It was rust forming on rust. It was Mother Nature laughing at the work of humans. It is one of those things where the average person would not give something the shortest glance, but I want to stop them and show them the beauty they are missing. Maybe you just have to be really detail oriented like me to see it. Maybe you have to be an engineer or scientist like me to appreciate rust. Or maybe you just have to be a crazy photographer like me to spend 15 minutes photographing rust. IMG_7772 IMG_7776 IMG_7779 IMG_7781 IMG_7783 IMG_7789 IMG_7806 IMG_7818 IMG_7828

Do not mess with a toxicologist

I was attending a lecture today on toxicology, and of course the subject people purposely poisoning other people came up. The lecture relayed the story of a female chemist who had a romantic relationship with a male chemist who worked in the same lab. The male then broke off the relationship and starting dating another female chemist who also worked in that same lab. The first female chemist evidently pretended like she was ok with everything and continued to make tea for everyone afterwards. However she started adding acrylamide to the male’s tea. It sounded like the poisoning was discovered fairly quickly. He then relayed another story of similar circumstances when a male broke off a relationship with another woman, but they continued to work together. She used thallium to poison his tea. She however was a toxicologist and made detailed notes of the effects on the male. She then adjusted the dosage accordingly. My lecturer did not relay information as to when she was caught. Summary of the story is don’t piss off a toxicologist, and if you do, don’t be stupid enough to let the person make your tea.

DISCLAIMER: This is in no way meant to encourage people to poison people. Don’t do that. Seriously, don’t.

SAS Macro to Validate CAS Registry Numbers

*updated 7/20/15 after finding more ways people write CASRN or create fake CASRN that will sneak through my original macro*

I wrote a simple and fairly short SAS macro to validate CAS Registry Numbers. I have gotten enough free SAS advice and a few macros from various internet sources, so I thought it only fair to share this if it of use to anyone. Hopefully the comments give ample information about what input is needed and what the output is. The macro will catch an invalid CAS RN if it is

  1. too long
  2. too short
  3. has all 0’s
  4. does not return the correct check digit based on CAS calculation

Information about proper CAS RNs can be found from ACS who produce CAS RNs. Contact me if you have questions about the macro or find an error with it.

*macro to determine if a CAS number is a valid CAS number;
*input is name of dataset to be examined where CAS numbers have variable name CAS_number;
*returns valid = 1 if CAS is valid and valid = 0 if invalid CAS;
*returns character variable CAS which will be CAS number with hyphens and no leading 0s;
%macro CASnumber_check(CAS_dataset);
data &CAS_dataset (drop = CAS_num CASlength R N1-N9 QR Q Rcheck j);
length CAS_num $ 10;
set &CAS_dataset;
*give CAS numbers with alphabet characters or that are blank a 00-00 CAS number;
if CAS_number = “” then CAS_number = “00-00”;
if anyalpha(CAS_number) ne 0 then CAS_number = “00-00”;
*determine if CAS is numeric or character variable;
CAS_vartype = vtype(CAS_number);
*if CAS is numeric, converts it to character;
if CAS_vartype = “N” then CAS_num = STRIP(PUT(CAS_number, 8.));
*if CAS is character, removes all non-numeric characters;
if CAS_vartype = “C” then CAS_num = compress(CAS_number,,”kd”);
*breaks CAS number apart into digits;
CASlength = length(CAS_num);
R = input(substr(CAS_num,length(CAS_num)),8.);
QR = 0;
array N_(9) N1 – N9;
do j = 1 to 9;
if CASlength > j then N_(j) = input(substr(CAS_num,CASlength-j,1),8.);
else N_(j) = 0;
QR = QR + N_(j)*j;
end;
Q = int(QR/10);
Rcheck = QR – Q*10;
*checks on validity of CAS based on check digit and length;
if Rcheck = R then valid = 1; else valid = 0;
if N9 = 0
then if N8 = 0
then if N7 = 0
then if N6 = 0
then if N5 = 0
then if N4 = 0 then valid = 0;
if CASlength < 5 then valid = 0;
if CASlength > 10 then valid = 0;
*builds character variable called CAS with no leading 0s;
if N9 ~= 0 then CAS = cats(N9,N8,N7,N6,N5,N4,N3,”-“,N2,N1,”-“,R);
else if N8 ~= 0 then CAS = cats(N8,N7,N6,N5,N4,N3,”-“,N2,N1,”-“,R);
else if N7 ~= 0 then CAS = cats(N7,N6,N5,N4,N3,”-“,N2,N1,”-“,R);
else if N6 ~= 0 then CAS = cats(N6,N5,N4,N3,”-“,N2,N1,”-“,R);
else if N5 ~= 0 then CAS = cats(N5,N4,N3,”-“,N2,N1,”-“,R);
else CAS = cats(N4,N3,”-“,N2,N1,”-“,R);
run;
%mend CASnumber_check;