07-12-2017 05:36 PM - last edited a month ago
Need a help in this program.Little complicated. I have 5 dates (Byear1,byear2...-5), I am trying to get a new calculated column (youngest) where I need only the age of the least birthyear (2017-1958). Some birthyear variables are blank.
How to identify the least year from the 5 dates?
create table test.age
as select (2017-(birtyear1)) as Age1,
(2017-(byear2)) as Age2,
(2017-(byear3)) as Age3,
(2017-(byear4)) as Age4,
(2017-(byear5)) as Age5,
Output should be like this!
Byear1 Byear2 Byear3 Byear4 Byear5 Age1 Age2 CalculatedCol(youngest)
1955 1958 0 0 0 62 59
1962 1965 0 1964 0 55 52
1979 1978 0 0 1962 38 38
07-12-2017 06:01 PM
You will get more (or maybe at least some) responses if you provide example have and want datasets in the form of data steps we can run. Your examples use different variable names and one can't really see what you are trying to do.
Art, CEO, AnalystFinder.com
07-12-2017 06:18 PM
MIN (of birthyear1-birthyear5) will provide the lowest value, ignoring missing values.
I would recommend you check what the standard is in your industry.
Apparently demographics uses Age as of June1st for particular years, so if you're merging it with other sources that's a good indicator.
When I did cancer research we had a different definition, so it can be industry/topic specific.