Hi. I am trying to merge 2 datasets by ID and based on quarterly date range. How can I do this?
What I have:
ID Date
1111 01/01/2018
2222 04/03/2018
etc etc
ID Amount 01/012018-03/31/2018 Amount 04/01/2018-07/30/2018 etc
1111 $1 $2
2222 $3 $4
etc etc etc
What I want:
ID Date Amount for that period
1111 01/01/2018 $1
2222 04/03/2018 $4
That data is not presented in a way which is useful for us. Please post a datastep with some test data so we have something that actually represents the data that we can run:
I can provide some tips however:
1) Re-model dataset 2, it is rarely a good idea to have wide (transposed) datasets, and will make your code far more complex and less robust. Remodel to:
ID START END AMOUNT
In this way your merge will become a lot simpler.
That data is not presented in a way which is useful for us. Please post a datastep with some test data so we have something that actually represents the data that we can run:
I can provide some tips however:
1) Re-model dataset 2, it is rarely a good idea to have wide (transposed) datasets, and will make your code far more complex and less robust. Remodel to:
ID START END AMOUNT
In this way your merge will become a lot simpler.
" Amount 01/012018-03/31/2018" is not real or validate sas variable name.
Post your real variable name .
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.