@saieedkhalil wrote:
I tried this:
DATANYTaxes; SET NYTaxes; datevar = input(date,yyyyQq.); format datevar date9.;
and got this response:
68 datevar = input(date,yyyyQq.);
_______
485
NOTE 485-185: Informat YYYYQQ was not found or could not be loaded.
PS My columns are date and TotalNYSTaxes respectively, with dates from 1994q1 to 2016q2/
Since a SAS data value is a number of days from a given starting date (01jan1960), SAS only has informats that contain also day values. formats that do not display a complete data value have no equivalent informat.
So you need to convert your YYYYqQ string into something that contains a complete date, and then you can use a date informat:
length date_int $10;
format datevar yymmddd10.;
date_int = substr(date,1,4) !! '-' !! put(input(substr(date,6,1),1.)*3,z2.) !! '-01';
datevar = input(date_int,yymmdd10.);
datevar = intnx('month',datevar,0,'end');
The final statement sets the date to the last day of the quarter, as I guess this would be more useful.
You can then use the YYQ6. format to display the date as a quarter.
... View more