BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
greg6363
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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.


 

View solution in original post

1 REPLY 1
Reeza
Super User

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.


 

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1286 views
  • 0 likes
  • 2 in conversation