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';
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.