Well, I'm afraid I'm back with another easy question, but I am stuck. Or rather, I haven't gotten this to work in a way that I am happy.
I have three datasets that have been successfully combined, no problems there. The problem is when I am looking at the data, a number of variables were changed over the years the data was gathered.
The question is, "how many of the last 12 months were you employed".
In 2007, this variable was titled Months (which was later used for something completely different, at least I figured out how to separate that mess). Then in 2008 it was changed to PastPay, and then in 2010 it was changed again to EMP_PAY. The data is pretty straightforward, respondents answered 1-12. So it would look like:
2007
Obs1 = 1
Obs2 = 3
Obs3 = 9
Obs3 = 5
Obs4 = 11
2008
Obs1 = 2
Obs2 = 3
Obs3 = 8
Obs3 = 12
Obs4 = 7
2010
Obs1 = 9
Obs2 = 2
Obs3 = 4
Obs3 = 1
Obs4 = 8
I've tried do loops with if/then statements, tried catx, and tried an array but I haven't been able to get them combined. (largely because I'm still learning SAS). Sorry, I'm sure I'll have 8 simple answers and feel really dumb here in about 10 minutes but I'm hitting a wall right now.
COALESCE().
Assumptions:
employed_prev12 = coalesce(Months, PastPay, Emp_Pay);
@DanielQuay wrote:
Well, I'm afraid I'm back with another easy question, but I am stuck. Or rather, I haven't gotten this to work in a way that I am happy.
I have three datasets that have been successfully combined, no problems there. The problem is when I am looking at the data, a number of variables were changed over the years the data was gathered.
The question is, "how many of the last 12 months were you employed".
In 2007, this variable was titled Months (which was later used for something completely different, at least I figured out how to separate that mess). Then in 2008 it was changed to PastPay, and then in 2010 it was changed again to EMP_PAY. The data is pretty straightforward, respondents answered 1-12. So it would look like:
2007
Obs1 = 1
Obs2 = 3
Obs3 = 9
Obs3 = 5
Obs4 = 11
2008
Obs1 = 2
Obs2 = 3
Obs3 = 8
Obs3 = 12
Obs4 = 7
2010
Obs1 = 9
Obs2 = 2
Obs3 = 4
Obs3 = 1
Obs4 = 8
I've tried do loops with if/then statements, tried catx, and tried an array but I haven't been able to get them combined. (largely because I'm still learning SAS). Sorry, I'm sure I'll have 8 simple answers and feel really dumb here in about 10 minutes but I'm hitting a wall right now.
COALESCE().
Assumptions:
employed_prev12 = coalesce(Months, PastPay, Emp_Pay);
@DanielQuay wrote:
Well, I'm afraid I'm back with another easy question, but I am stuck. Or rather, I haven't gotten this to work in a way that I am happy.
I have three datasets that have been successfully combined, no problems there. The problem is when I am looking at the data, a number of variables were changed over the years the data was gathered.
The question is, "how many of the last 12 months were you employed".
In 2007, this variable was titled Months (which was later used for something completely different, at least I figured out how to separate that mess). Then in 2008 it was changed to PastPay, and then in 2010 it was changed again to EMP_PAY. The data is pretty straightforward, respondents answered 1-12. So it would look like:
2007
Obs1 = 1
Obs2 = 3
Obs3 = 9
Obs3 = 5
Obs4 = 11
2008
Obs1 = 2
Obs2 = 3
Obs3 = 8
Obs3 = 12
Obs4 = 7
2010
Obs1 = 9
Obs2 = 2
Obs3 = 4
Obs3 = 1
Obs4 = 8
I've tried do loops with if/then statements, tried catx, and tried an array but I haven't been able to get them combined. (largely because I'm still learning SAS). Sorry, I'm sure I'll have 8 simple answers and feel really dumb here in about 10 minutes but I'm hitting a wall right now.
Thank You again Reeza,
And I'm sorry, I promise, I'm trying to learn how to ask questions better.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.