Help using Base SAS procedures

How to detect if files are the same

Reply
New Contributor
Posts: 2

How to detect if files are the same

[ Edited ]

Hello team

 

please help me in this resolve this problem

how to know, if client has sent same last month file this time too.

 

 

Thanks

nagmani 

Super User
Posts: 19,789

Re: SAS

[ Edited ]

PROC COMPARE

 


nagmani wrote:

Hello team

 

please help me in this resolve this problem

how to know, if client has sent same last month file this time too.

 

 

Thanks

nagmani 


 

New Contributor
Posts: 2

Re: SAS

Thanks Reeza, but how to know it has been already sent my client last month. Plz give code.
Super User
Posts: 19,789

Re: SAS

Explain your situation.

Occasional Learner
Posts: 1

Re: How to detect if files are the same

 

Your requirement:

please help me in this resolve this problem

how to know, if client has sent same last month file this time too.

 

Need more information on your query.

 

1. Last month file data available with you or not

2. If yes read the current month file and stored the data in temparory dataset and compare with last month loaded data

 

Regards,

Kishore

 

Super User
Super User
Posts: 7,952

Re: How to detect if files are the same

First, do you have a proper data import process, i.e. do you have an import agreement setup between you and the supplier?  If not this would be first port of call, without an agreement you will never know what you get, maybe next month they print the output, stick it onto the back of a cornflake box and post it to you??  

Secondly, in your post, you really give no information.  What type of file is it that is being sent.  What environment are you working in?   If its a text file and you have a version control system, then drop the file over the previous received file and then do a diff in the version control software.  If its a PDF file then use PDF diff.  If its a dataset then use proc compare.

Can you see how from the above alone, providing enough information helps answer the question?

Super User
Posts: 19,789

Re: How to detect if files are the same

I've modified your subject line, please try to use a descriptive subject line in the future.
Trusted Advisor
Posts: 1,562

Re: How to detect if files are the same

When you get a client's file you probably save it on your computer.

Do you know from whom you got it and for which month?

Can you check that file data relate to that same month?

Is it possible that the file contains data from more than one month?

 

How do you name the file? Can you recognize client and month according to file name?

 

To answer "how to detect if files are same", your better have answers to those questions first,

then use, as proposed by @Reeza, PROC COMPARE to compare current file to lprevious

if client and declared month are the same or suspicious to be the same.

 

the code for proc compare (there are more options):

proc compare data = old_file_name
                compare = new_file_name;
    id  <list of ID variable names, assumed data is sorted by IDs >;
run;
Super User
Posts: 11,343

Re: How to detect if files are the same

If this were a concern I would be strongly tempted to use an OS tool before reading into SAS. FC in windows from a command prompt for example.

Ask a Question
Discussion stats
  • 8 replies
  • 200 views
  • 4 likes
  • 6 in conversation