I have a table as below sample:I wanted to update UDF_value of the matching CASE_RK when udf_nm='x_case_prd' .so I wanted to see 2016q3 to change 2016q4 for all x_case_prd when maching case_rk.Can I do that in just few steps. I can use substr and concatenate with write period but Need to know if there is another quick solution to this?
CASE_RK | VALID_FROM_DTTM | UDF_TABLE_NM | UDF_NM | ROW_NO | UDF_VALUE |
3837195 | xx | CASE | X_CASE_PRD | 1 |
2016Q3
|
Sounds pretty straight-forward....
proc sql;
update work.have
set udf_value = '2016q4'
where udf_nm='X_CASE_PRD' ;
quit;
I could not understand what you wanted to do.
Typically, you can update datasets via proc sql:
If you want to update the new column to a null value if it can't find a match, then you might use something like this:
proc sql;
update work.have as t1
set t1.udf_value=(select new_value from some_data_set where col=t1.col)
where t1.udf_nm='X_CASE_PRD' ;
quit;
If you want to update the new column only when there is a match, you can add to the criteria:
proc sql;
update work.have as t1
set t1.udf_value=(select new_value from some_data_set where col=t1.col)
where t1.udf_nm='X_CASE_PRD' and exists (select new_value from some_data_set where col=t1.col);
quit;
I am trying to update UDF_VALUE COLUMN from 2016q3 to 2016q4(so need to change the suffix quarter from q3 to q4) where udf_name="X_CASE_PRD" .
Sounds pretty straight-forward....
proc sql;
update work.have
set udf_value = '2016q4'
where udf_nm='X_CASE_PRD' ;
quit;
Yes, I twisted the query above and it worked for me. Thank you
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.