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

Sample Data:

I would like to know how to copy values of MILK from B to C

OBSABC
1COFFEE$16.80$16.80
2COFFEE$27.14$27.14
3COFFEE$49.20$49.20
4COFFEE$65.00$65.00
5COFFEE$66.70$66.70
6MILK$38.46$0.00
7MILK$128.20$0.00
8MILK$66.50$0.00
9MILK$32.05$0.00
10MILK$30.06$0.00
11MILK$14.85$0.00
12TEA$34.60$34.60
13TEA$1.73$1.73
14TEA$70.93$70.93
15TEA$6.92$6.92
16EXPRESSO$34.60$0.00
17EXPRESSO$10.38$0.00
18EXPRESSO$17.30$0.00

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
data want;
set have;

if a = 'MILK' then C = B;

run;

You can use a conditional IF statement. 

 


@Gladis6680 wrote:

Sample Data:

I would like to know how to copy values of MILK from B to C

OBS A B C
1 COFFEE $16.80 $16.80
2 COFFEE $27.14 $27.14
3 COFFEE $49.20 $49.20
4 COFFEE $65.00 $65.00
5 COFFEE $66.70 $66.70
6 MILK $38.46 $0.00
7 MILK $128.20 $0.00
8 MILK $66.50 $0.00
9 MILK $32.05 $0.00
10 MILK $30.06 $0.00
11 MILK $14.85 $0.00
12 TEA $34.60 $34.60
13 TEA $1.73 $1.73
14 TEA $70.93 $70.93
15 TEA $6.92 $6.92
16 EXPRESSO $34.60 $0.00
17 EXPRESSO $10.38 $0.00
18 EXPRESSO $17.30 $0.00

 


 

View solution in original post

2 REPLIES 2
Reeza
Super User
data want;
set have;

if a = 'MILK' then C = B;

run;

You can use a conditional IF statement. 

 


@Gladis6680 wrote:

Sample Data:

I would like to know how to copy values of MILK from B to C

OBS A B C
1 COFFEE $16.80 $16.80
2 COFFEE $27.14 $27.14
3 COFFEE $49.20 $49.20
4 COFFEE $65.00 $65.00
5 COFFEE $66.70 $66.70
6 MILK $38.46 $0.00
7 MILK $128.20 $0.00
8 MILK $66.50 $0.00
9 MILK $32.05 $0.00
10 MILK $30.06 $0.00
11 MILK $14.85 $0.00
12 TEA $34.60 $34.60
13 TEA $1.73 $1.73
14 TEA $70.93 $70.93
15 TEA $6.92 $6.92
16 EXPRESSO $34.60 $0.00
17 EXPRESSO $10.38 $0.00
18 EXPRESSO $17.30 $0.00

 


 

Gladis6680
Obsidian | Level 7

Thank you so much.

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2 replies
  • 720 views
  • 0 likes
  • 2 in conversation