- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Deepuu wrote:
Need a Macro to update the values in the Sas dataset automatically if there is an update in excel sheet , if there is no update then the data set should not update. Please help me with code as I am starter. Thank u all!
1) Explain why you need a macro, and what you think that will get you?
2) Define "automatically".
3) Is your dataset an exact replica of your Excel worksheet? If so, then just reimport the worksheet and overwrite your dataset. If not, then add more detail to your question.
Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You will need to
- Import the Sheet (=work.sheet)
- Compare it with an older and permanently saved version of the dataset (=archive.sheet)
- Use the return code of proc compare to decide whether a relevant change was found or not.
Always keep in mind, that using an Excel sheet as data-source is close to the worst decision possible, when deciding about file-types. There are numerous posts explaining the problems that will occur, so i skip that now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since a change in the spreadsheet might easily cause a change in the structure of the dataset, updates cannot be done (simply) in a reliable way.
You can only rewrite the dataset and try to live with the unpredictable results.
To make such a process sustainable and reliable, you need to cut Excel out of your data processing chain.