Can someone help me to write the macors for 6 months prior to YYYYMM date in YYMMN format which is already there in Temp dataset as shown below.
ID Region YYYYMM
2205500483 3742 201503
1105661211 3411 201410
2010452387 4605 201501
call symput('Hist',"'"||put(intnx('month', YYYYMM, -6), YYMMN.)||"'");
Create table Test as
Select id, Region, YYYYMM, &Hist. as Effect_date
order by id;
This step is not working.
Dates and times are numeric. Dates are number of days since Jan1960 for example. How you display them is by using the apropriate format, e.g. yymm. If you need a character varaible - i.e. it is no longer a date - then you use put() function:
data test; set temp; effect_date=put(intnx('month',yymm,-6),yymm6.); run;
I would suggest do some reading on formats, a minor change to the format is all that is required, however you should know how to display data using formats, its a key item:
data test; yymm="12Aug2011"d; effect_date=put(intnx('month',yymm,-6),yymmn6.); run;
Read very carefully everything under this link:
It is very important that you fully understand this and it will make your SAS coding life quite a bit easier if you do so,