BookmarkSubscribeRSS Feed
sorosch
Fluorite | Level 6

Hello,

i want to insert a SAS Table into Oracle. Normally i use PROC SQL. But in this case i must recode or query every row in the SAS table - and after this the row should be inserted or not in Oracle.

This i want to do (with pseudo-code):


read until sas_base_table is EOF

  "recode/do something with" the sas_base_row

  if sas_base_row is a hit then
    insert into oracle_table
  else
   DO NOTHING
  end if

end read


How can i do that? Is there somewhere perhabs an example?

Thank you very much
Best regards
George

2 REPLIES 2
Tom
Super User Tom
Super User

Why ?

 

If you want to write to Oracle using a data step then make a libref that points to your Oracel schema.

libname MYDB oracle .... ;

Generate the rows you want to insert. For example you could use a conditional OUTPUT statement in your data step to select the rows to insert.

data toadd ;
  set ....
  if ... then output;
run;

Then insert them.

proc append base=mydb.mytable data=toadd force;
run;

 

sorosch
Fluorite | Level 6
Thank you very much for your help.

Best regards
George

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 2262 views
  • 1 like
  • 2 in conversation