Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blanking Out A Field

Status
Not open for further replies.

DonaZ

Technical User
Oct 10, 2007
41
US
I want to blank out only some fields from a record, but do not know how. I tried case statements and if statements but am running into a wall. I would appreciate your help.

For those records with a confidentiality code=X, I want to blank out the names, but want to leave the other fields populated.

Record # Confidentiality Firstname Lastname Produce
1 Jane Smith apples
2 X oranges
3 X pears
4 John Deer grapes



What am I doing wrong?

Thank you for your time.
 
Thank you. I solved my problem.

proc sql;

create table Test1 as
select *,
case when confidentiality is null then Firstname
else "."
end as fname
from TEST
;
quit;
 
I think this is one of the ways to do.

data data1;
infile datalines missover dlm = ' ' ;
input var1 @3 var2 $char1. @ ;
if var2 ne 'x' then do;
input @5 fname $ @10 lname $ @;
end;
input @16 pduce $;
datalines;
1 jane smith ornages
2 x apples
3 x grapes
4 jon drv melons
;
run;

proc print;
title 'data produce';
title ;
run;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top