Help using Base SAS procedures

problems with deleting a variable.

Reply
N/A
Posts: 1

problems with deleting a variable.


Hey guys hope you can help me out on this one.

I have a database of 13 ships with alot of other variables.

I am trying to delete one of these ships from my database.

i have a variable collum called: VESSEL

I am using the following code:

Data new;

set Remco.tuna;

if vessel= 'urkkotter' then delete;

run;

Sas runs the code and does create a new table however, it does not delete the vessel 'urkkotter'

resulting in the new table being exactly the same as the Remco.tuna table.

I get no errors or notes in the log file.

Hope you can help out.

Remco.

Super User
Super User
Posts: 6,495

Re: problems with deleting a variable.

Most likely the value in the variable is different than what you used in the IF statement.

Possibilities are:

Case differences. Try lowcase(vessel) = 'urkkotter'

Leading spaces in the variable.  Try strip(vessel)='urkkotter'

Other hidden characters such as tab or non-breaking space.  Use PUT VESSEL= $HEX. ; To see in the log the actual values.

The variable is formatted and you are trying to select on the formatted value instead of the actual value.  Try Vvalue(vessel) = 'urkkotter'

Ask a Question
Discussion stats
  • 1 reply
  • 185 views
  • 0 likes
  • 2 in conversation