Hi,
I am looking to create a table that only pulls the result MAR2019 from the MTH_END variable. MTH_END is a numeric variable (shown by the screenshot below) and I have already successfully done a left join to connect two datasets - all of my proc sql code has worked without this extra condition that I want to include but I am not sure how to complete the line below (highlighted in red), given that MAR2019 is a mixture of components. Can someone please help with completing the line below ('a.cards_2019 is the dataset that I have already successfully referenced after doing the left join)? Thanks.
where a.cards_2019= ????????????? ;
If you want month-end values only:
where a.cards_2019='31mar2019'd;
if you want the entire month
where '01mar2019'd <= a.cards_2019 <= '31mar2019'd;
Keep in mind that the MONYY7. Format will display 01mar2019 the same as 31mar2019: MAR2019
Let me know is it makes sense 🙂
please try
where a.cards_2019= 21609;
If you want month-end values only:
where a.cards_2019='31mar2019'd;
if you want the entire month
where '01mar2019'd <= a.cards_2019 <= '31mar2019'd;
Keep in mind that the MONYY7. Format will display 01mar2019 the same as 31mar2019: MAR2019
Let me know is it makes sense 🙂
Hi @jeremy4 Sorry for the late entry, for what it's worth
the expression also can be written as
where put(a.cards_2019,monyy7.)='MAR2019';
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.