04-04-2016 10:51 PM
I tried to use the followng format and put function to revalue yr_qt variable, however the first row of the format could not show off ("2011_Q1"='1.2011_Q1' ). After put function, the 2011_Q1 is still 2011_Q1 instead of 1.2011_Q1 .
I am wondering what is wrong. Thank you very much.
proc format ;
'All years'='0.ALL years'
yr_qt_1 = put ( yr_qt, yr_qtf. ) ;
04-05-2016 12:17 AM
Instead of this, you may want create a custom format to display the date in that format rather than add the 1. etc I'm assuming it's to order the data, but it looks uglier in my opinion in this format. In fact, it should sort naturally, so I'm not sure why you're doing this at all...
Look into proc picture and how to create a custom date format.
You can also look into a multilabel format to create multiple levels when formatting.
Formats are extremely powerful, they're worth learning well.
To diagnose your problem with your format for example you can use the following to see how proc format stored the format and noticed that the first one was missing so you could check your code.
proc format cntlout=check_format; run; proc print data=check_format; run;