Help using Base SAS procedures

creating new variable during merge

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
Accepted Solution

creating new variable during merge

Hi,

How can i create new variable flag=1 in the WANT dataset?????

data want;

mergehave1(in=a) have2(in=b);

byID;

if a;

run;

Thanks


Accepted Solutions
Solution
‎12-17-2013 10:06 AM
PROC Star
Posts: 7,416

Re: creating new variable during merge

If no conditions are involved the simplest way would be to include a retain statement:

data want;

  merge have1(in=a) have2;

  by ID;

  retain flag 1;

  if a;

run;

View solution in original post


All Replies
Solution
‎12-17-2013 10:06 AM
PROC Star
Posts: 7,416

Re: creating new variable during merge

If no conditions are involved the simplest way would be to include a retain statement:

data want;

  merge have1(in=a) have2;

  by ID;

  retain flag 1;

  if a;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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