What is the syntax to update a column in SAS using Proc SQL

Posted on 2012-09-21
Medium Priority
Last Modified: 2012-09-25
I would like to update field A in table A with the value of Field B in Table B.  What is the syntax to do this is SAS using Proc SQL?
Question by:morinia
1 Comment
LVL 14

Accepted Solution

Aloysius Low earned 2000 total points
ID: 38426117
you'll need to perform an outer join against table A then use a case statement to update the value. offhand, without testing, my code would look something like this but not sure if it'll work... i don't think a direct update will work, but is PROC SQL a requirement? is data step acceptable?

proc sql;
  create tableA as
    select [list relevant columns],
      (case tableB.fieldB when "" then tableA.fieldA else tableB.fieldB end) as fieldA
    from tableA left join tableB
    on tableA.[ID column] = tableB.[ID column];

if the field is numeric, then replace "" with . (period)

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question