BookmarkSubscribeRSS Feed
Deepuu
Calcite | Level 5
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!
3 REPLIES 3
ScottBass
Rhodochrosite | Level 12

@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.
andreas_lds
Jade | Level 19

You will need to

  1. Import the Sheet (=work.sheet)
  2. Compare it with an older and permanently saved version of the dataset (=archive.sheet)
  3. 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.

Kurt_Bremser
Super User

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 466 views
  • 0 likes
  • 4 in conversation