I've a dataset that has wrong dates created off of a excel drag function. How can I compare and identify the dates that are exactly one day apart in the sequence to alert the team?
Thank you
ProductID | Date_shipped |
P3456 | 10/2/2023 |
R2342 | 10/3/2023 |
H9875 | 10/4/2023 |
L5543 | 10/5/2023 |
Use the DIF function.
data want;
set have;
days=dif(date_shipped);
run;
Use the DIF function.
data want;
set have;
days=dif(date_shipped);
run;
Thank you.
DIF function works, but is there any similar function to DIF to use in Proc SQL?
ERROR: The DIF function is not supported in PROC SQL, it is only valid within the DATA step.
I have all my filters in SQL. Just for handling DIF function I have to recreate the whole dataset and order it again.
@Stalk wrote:
Thank you.
DIF function works, but is there any similar function to DIF to use in Proc SQL?
ERROR: The DIF function is not supported in PROC SQL, it is only valid within the DATA step.
I have all my filters in SQL. Just for handling DIF function I have to recreate the whole dataset and order it again.
SQL by its very nature knows nothing about the ORDER of observations so it is a terrible choice to do something like this.
Your second statement makes no sense at all. How are going to create a new VARIABLE without creating a new dataset, whether you use SQL query or a data step?
Note that you can create views using either PROC SQL code or data step code you want to avoid making multiple physical copies of the data.
Do you have other identification information such as a purchase order/bill of lading/ what have you? It would likely be a good idea to only report these one day increments in the case of some group identified as such.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.