BookmarkSubscribeRSS Feed
abd_khan11
Calcite | Level 5

Hey everyone!

 

I'm a new user working on an assignment and was curious as to whether we can convert the informat yyq6. (Ex: 2017Q1) to mmddyy10. So 2017Q1 would be converted to 1/1/2017 and 2017Q2 would be converted to 4/1/2017, the start of the second quarter of 2017, and so on. Any pointers appreciated. Thank you!

1 REPLY 1
ballardw
Super User

Informats read data and depend on the text read. The formats that read intervals like YYQ will generally take on the first calendar date of the interval as SAS date values must have a day of the month. So the informat process implies the first day of the period involved.

 

Formats, which display the values, can be changed any time you want. There may be a default format assigned such as YYQ1 but any procedure you want you can change that.

 

You may need to change actual data depending on your values. A format like YYQ displays 3 months worth of dates as the same formatted value and could have many, as in any specific date of the year during the quarter, values in your data.

 

I suggest that you try printing your data with Proc Print and add a statement like : Format nameofyourdatevariable mmddyy10. ;

 

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
  • 1 reply
  • 181 views
  • 0 likes
  • 2 in conversation