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 .
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.