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

 

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