Proc sql updating multiple columns

Posted by / 06-Oct-2017 00:21

Proc sql updating multiple columns

Hello, I am learning using PROC SQL to replace the data step for data extraction.

I use PROC SQL / UPDATE statement, I found that I didn't update my data correctly, I lost some portion of my original ones.

By using the UNDO_POLICY= option, you can control whether the changes that have already been made will be permanent.

The UNDO _POLICY= option in the PROC SQL and RESET statements determines how PROC SQL handles the rows that have been inserted or updated by the current INSERT or UPDATE statement up to the point of error.

For more information about updating views, see Updating a View.The following UPDATE statements result in different population increases for different countries in the NEWCOUNRTRIES table.proc sql; update sql.newcountries set population=population*1.05 where name like 'B%'; update sql.newcountries set population=population*1.07 where name in ('China', 'Russia'); title "Selectively Updated Population Values"; select name format=., capital format=., population format=comma15.0 from sql.newcountries; Selectively Updated Population Values Name Capital Population ------------------------------------------------------ Brazil Brasilia 168,325,875 China Beijing 1,286,370,132 India New Delhi 929,009,120 Indonesia Jakarta 202,393,859 Russia Moscow 161,666,278 United States Washington 263,294,808 If you omit the ELSE clause, then each row that is not described in one of the WHEN clauses receives a missing value for the column that you are updating.The UPDATE statement updates data in existing columns; it does not create new columns.To add new columns, see Altering Columns and Creating New Columns.

proc sql updating multiple columns-67proc sql updating multiple columns-3proc sql updating multiple columns-15

(The two underscores represent any character.) The CASE expression returns a value for each row that completes the SET clause.