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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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