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

Posted on 2012-09-21
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

    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

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction After workin in a plethora of programming languages like C, Pro*C, ESQL/C, C++, VC++, VB, Java, HTML,JavaScipt etc, technologies and frameworks like JSP, Servlets, Struts, Spring, IBatis etc and databases like MS Access, SQLServer, Inf…
    In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now