Hi All,
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?
proc sql;
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,
from..
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
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
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.