I'm trying to use the update command in a PROC SQL query to change a particular type of value within a stated field. Here is my code:
proc sql;
update test_set_1
set acct_number='.'
where acct_number like '2-*';
I am using a wild card value to capture all the fields that have the value of 2-XXXXXX which is why used the * as a wild card indicator. I want to replace that value with a missing value so I can perform a coalesce statement to reference values from other columns. Unfortunately, when I run the code, I get the following message:
No rows were updated in work.test_set_1
Is it a formatting issue? Wouldn't it have been mentioned in the log file? Any assistance would be greatly appreciated.
SQL uses % as the wild card for LIKE in most flavours that I'm familiar with...
proc sql;
update test_set_1
set acct_number='.'
where acct_number like '2-%';
quit;
@greg6363 wrote:
I'm trying to use the update command in a PROC SQL query to change a particular type of value within a stated field. Here is my code:
proc sql;
update test_set_1
set acct_number='.'
where acct_number like '2-*';
I am using a wild card value to capture all the fields that have the value of 2-XXXXXX which is why used the * as a wild card indicator. I want to replace that value with a missing value so I can perform a coalesce statement to reference values from other columns. Unfortunately, when I run the code, I get the following message:
No rows were updated in work.test_set_1
Is it a formatting issue? Wouldn't it have been mentioned in the log file? Any assistance would be greatly appreciated.
SQL uses % as the wild card for LIKE in most flavours that I'm familiar with...
proc sql;
update test_set_1
set acct_number='.'
where acct_number like '2-%';
quit;
@greg6363 wrote:
I'm trying to use the update command in a PROC SQL query to change a particular type of value within a stated field. Here is my code:
proc sql;
update test_set_1
set acct_number='.'
where acct_number like '2-*';
I am using a wild card value to capture all the fields that have the value of 2-XXXXXX which is why used the * as a wild card indicator. I want to replace that value with a missing value so I can perform a coalesce statement to reference values from other columns. Unfortunately, when I run the code, I get the following message:
No rows were updated in work.test_set_1
Is it a formatting issue? Wouldn't it have been mentioned in the log file? Any assistance would be greatly appreciated.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.