Help using Base SAS procedures

Update existing and insert new record to sas dataset.

Reply
Contributor
Posts: 31

Update existing and insert new record to sas dataset.

Hi,

my criteria is to update the existing record if it exists in the cumulative dataset else if it is new record then it needs to be added to the cumulative dataset. The cumulative data contains history data .

I tried the below but it didnt work. Any other suggestions-

 

data adhoc.dly_cumulative;

update adhoc.dly_cumulative  adhoc.dly_&day0

by column;

run;

Super User
Posts: 17,864

Re: Update existing and insert new record to sas dataset.

How didn't it work?

Update is designed exactly that function, update record if it exists or add it in otherwise.

Contributor
Posts: 31

Re: Update existing and insert new record to sas dataset.

 

ERROR 411-185: The UPDATE statement requires two data sets, too many data sets have been specified.

This is the error i am getting when trying to execute the above.

Super User
Posts: 17,864

Re: Update existing and insert new record to sas dataset.

Post your full log then. My *guess* is that your macro variable is resolving with spaces so the update statement see's 3 datasets?

Regular Contributor
Posts: 184

Re: Update existing and insert new record to sas dataset.

UPDATE, or MODIFY??

Super User
Posts: 5,085

Re: Update existing and insert new record to sas dataset.

It looks like you need to add a semicolon at the end of the UPDATE statement.  The software thinks BY and COLUMN are names of additional data sets.

Contributor
Posts: 31

Re: Update existing and insert new record to sas dataset.

Yes it worked after adding the semicolon. Thank you!!

Ask a Question
Discussion stats
  • 6 replies
  • 521 views
  • 3 likes
  • 4 in conversation