r - Date format in SAS -
i have sas code need convert r.
my sas code -
proc sql; create table data select a.*,b.qty sales inner join units b on a.id=b.id , put(a.date,yymmn6.)=put(c.date,yymmn6.) quit;
i know put(a.date,yymmn6.) converts date sas date value. a.date become after function? if date=01jan2012, put(a.date,yymmn6.) makes sas value represents 201201 or 20120101? i.e. sas value created stand whole date or year , mon of date?
currently, writing r code -
data <- sqldf("select a.*,b.qty sales inner join units b on a.id=b.id , a.date=c.date")
should doing -
sales$date <- as.yearmon(sales$date) units$date <- as.yearmon(units$date) data <- sqldf("select a.*,b.qty sales inner join units b on a.id=b.id , a.date=c.date")
i don't have access sas , hence, cannot try out on sample data. great. thanks!
put(a.date,yymmn6.) converts numeric date value character value stored yyyymm (e.g. 201201). therefore join condition matching dates month , year same, not day. i'm not sure of best way of achieving in r, seem have ideas on this. hope helps.
Comments
Post a Comment