BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jeremy4
Quartz | Level 8

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= ????????????? ;

 

Month end 2019.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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 🙂

View solution in original post

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

please try

 

where a.cards_2019= 21609;

Thanks,
Jag
PeterClemmensen
Tourmaline | Level 20

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 🙂

novinosrin
Tourmaline | Level 20

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'; 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1424 views
  • 2 likes
  • 4 in conversation