enterprise guide - SAS function to remove data if the month matches between 2 dates in 2 set of columns -


i have large data dates on 2 columns (15 years data). looking remove date if month between 2 columns match (dont care day or year) ex: 01feb2006 - 01feb2017 need remove date month matches while 16feb2006 - 23jun2017 doesn't therefore need new column difference 4 months. if difference +/- 30 days between 2 months, have removed ex: 01jan2005 - 20dec2014. please help! still learning sas. in advance help.

okay. question bit unclear. i've deduced question has number of potential questions:

"delete obeservations have matching months"

this may obtained using month function. (or if date string substring.) http://support.sas.com/documentation/cdl/en/lrdict/64316/html/default/viewer.htm#a000197966.htm

data refined;     set begin;     month1=month(date_var1 );     month2=month(date_var2 );      if month1= month2 delete;  run; 

"i need new column difference 4 months."

intck if friendly function here. can calculate timedifferences between dates. http://www.sascommunity.org/wiki/intck_function_examples

data refined;     set begin;     timedifference = intck('month', date_var1, date_var2); run; 

"if datedifference +-30 days delete observation"

same above, days in case.

data refined;     set begin;     timedifference = intck('days', date_var1, date_var2) ;     if abs(timedifference) <=30 delete; run; 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -