Tag: Logic

To Exit or Not Exit, the SAS Ways

The tragedy of life is not that it ends so soon, but that we wait so long to begin it. –by W. M. Lewis So, which is the exit style you prefer, in the following 3 macros (which are all valid SAS codes): /*#1 if branch*/ %macro tragedy_of_life1(ds);     %if %sysfunc(exist(&ds)) %then %do;         proc […]

Frequentist or Baysian

A latest updated post on Freakonomics, Beware the Weasel Word “Statistical” in Statistical Significance!,  seemed to attempt to challenge frequentist statistics by Bayesian. I have no research on Bayesian and won’t jump to the debates. I’d rather to use this case to apply the Dragon’s Teeth and Fleas logic of hypothesis testing (at least I […]

Example 9.26: More circular plotting

SAS’s Rick Wicklin showed a simple loess smoother for the temperature data we showed here. Then he came back with a better approach that does away with edge effects. Rick’s smoothing was calculated and plotted on a cartesian plane. In this entry we’…

Recursion: Biblical Evidences

                    
             To Iterate is Human, to Recurse, Divine. 
      –by L. Peter Deutsch, creator of Ghostscript. (I also love his saying “The best thing about a Boolean is even if you are wrong, you are only off by a bit”)

I learned this quote from Tony Barr, designer and developer of SAS (the Statistical […]

Power of Logic Operators: a trick

Suppose you should group people based on their ages as follows:

ID
Age
agegrp

001
1
1

002
4
2

003
5
2

004
5
2

005
2
1

006
4
2

007
5
2

008
2
1

009
9
3

010
8
3

and the rules:
age<4,           group 1
4<=age<6,     group 2
6<=age<10,  group 3
It is a very simple question and you could use the if/else statement without thinking:
data age;
input ID $ age;
datalines;
001 1
002 4
003 5
004 5
005 2
006 4
007 5
008 2
009 9
010 8
;
data age1;
set age;
if age<4   then agegrp=1;
else if […]

Logics in mathematics and in daily life: a statistical programming example

Refresh some basic logical propositions (or statements):
implication:       if       P then       Q (P—>Q)
inverse:            if not P then not Q (-P—>-Q)
converse:         if       Q then       P (Q—>P)
contrapositive: if not Q then not P (-Q—>-P)
contradition:    if       P then not Q (P—>-Q)

Mathematically or logically speaking, if the implication statement holds, then the contrapositive holds, but the inverse does not hold, […]