BookmarkSubscribeRSS Feed
MJM11111
Calcite | Level 5

Hi,

 

can someone please help me.

 

I have a Colum with a few different statuses in that specific column.

I only want 1 status to show on my output- for example there is statuses fraud, Other, STP-Wait, i only want Fraud to display on my data output.

 

I am not sure what i am doing wrong but it gives me blanks- and i know there is a Fraud status.

 

please help me 

 

Mellissa 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

I think in cases like this, you have to show us your code (please paste it into the box that appears when you click on the "little running man" icon) and you have to show us a portion of the data itself (not by typing some of it into a sentence, but by providing a portion as working SAS data step code).

--
Paige Miller
radhames_gomez
Calcite | Level 5

Hi Mellisa,

 

Please i would think you're trying to get the last status or the first status on your data.  Please add some SAS code that show us which are your inputs.

 

regards,

 

Juan R. Gomez

Tom
Super User Tom
Super User

What type of variable has the STATUS information?  Is it numeric or character?  Does it have a display format attached to it? Which one.

 

If the variable is character and does not have a format that changes how it is displayed attached then you need to make sure to use the same case letters and include any leading spaces (trailing spaces are ignored).  'Fraud' is different than 'FRAUD' or 'fraud' or '  Fraud'.

data want;
  set have;
  where upcase(left(status)) = 'FRAUD' ;
run;

If the variable is numeric and has a user defined format attached to it that prints the values like Fraud then you need to know what actual numbers the format maps to Fraud. 

data want;
   set have;
   where status = 1 ;
run;

Or you could use a subsetting IF statement instead of WHERE statement.  Then you could use the VVALUE() function to test the value as displayed by the format without needing to know the name of the format.

data want;
  set have;
  if 'Fraud' = vvalue(status);
run;

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 508 views
  • 0 likes
  • 4 in conversation