proc sql vs data step for looking up values form a reference table that
includes exceptions
I am trying to find out tax values for a particular good in a particular
city in a particular state. Tax values are in a reference table like this:
state city Good tax
---------------------------------
all all all 0.07
all all chicken 0.04
all jackson all 0.01
arizona all meat 0.02
arizona phoenix meat 0.04
arizona tucson meat 0.03
hawaii all all 0.08
nevada reno cigar 0.11
nevada vegas cigar 0.13
Now lets say if I am looking for tax for (nevada reno cigar) an exact
match exists in the reference so the answer is 0.11. But, if I look for
(nevada reno chicken) an exact match does not exist, but (all all chicken)
can be used as reference and output will be 0.04.
For such look up process I could not think of a proc sql method logic or
match-merge data step logic that handles this situation.
No comments:
Post a Comment