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

I have a SAS Date variable (Date) in the format YYYYMMDD : 2017-10-15. When I convert it to MONYY7. (Date1) it displays OCT2017, which is great, but it remembers the day ?  So when I Group on Date1, I get Two groups, because Date has Values of 14th October 2017 and 15th of October 2017.  How do I stop this ?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@alan01011 wrote:

I have a SAS Date variable (Date) in the format YYYYMMDD : 2017-10-15. When I convert it to MONYY7. (Date1) it displays OCT2017, which is great, but it remembers the day ?  So when I Group on Date1, I get Two groups, because Date has Values of 14th October 2017 and 15th of October 2017.  How do I stop this ?


What do you mean by "when I group on Date1..."??? How do you do the grouping? Show us the code.

 

Generally, most SAS procedures (but not all) that do grouping will recognize the format and all records in OCT 2017 will be grouped together. One particular exception is PROC SQL, which does not group by formatted values.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@alan01011 wrote:

I have a SAS Date variable (Date) in the format YYYYMMDD : 2017-10-15. When I convert it to MONYY7. (Date1) it displays OCT2017, which is great, but it remembers the day ?  So when I Group on Date1, I get Two groups, because Date has Values of 14th October 2017 and 15th of October 2017.  How do I stop this ?


What do you mean by "when I group on Date1..."??? How do you do the grouping? Show us the code.

 

Generally, most SAS procedures (but not all) that do grouping will recognize the format and all records in OCT 2017 will be grouped together. One particular exception is PROC SQL, which does not group by formatted values.

--
Paige Miller
alan01011
Calcite | Level 5

Thanks

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 2 replies
  • 459 views
  • 0 likes
  • 2 in conversation