proc sql vs data step for looking up values form a reference table that includes exceptions

前端 未结 3 1946
-上瘾入骨i
-上瘾入骨i 2021-01-25 18:39

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         


        
3条回答
  •  萌比男神i
    2021-01-25 19:23

    If its something that you only need to do once(i mean not an ongoing process) , then probably a easy way out could be dividing ur dataset into multiple datasets. One dataset would have all observations that have all 'all's in state,observation and good. Another one would have only state or city or good only as All. Another dataset would be a combination of two ALLs in either state/city , city/good or state/good. Making a total of 8 datasets i guess(including a dataset for no Alls in any of the variables. Then when you know which variables has alls , you can merge accordingly . For example - For a dataset with state , city , good u can have a tax of 0.07 without any merge. For a dataset with state and city = 'All' you only need to merge on good. Only other way/option of doing this imo would be to create three new datasets having two variables where var1 = all in all cases and var2 = all city names(multiple obs)/ all state names(multiple obs)/all goods names(multiple obs) and then merge to ur original dataset on var1 to have multiple rows in ur original dataset instead of having ALLs

提交回复
热议问题