DATA Step, Macro, Functions and more

complete series

Reply
Contributor
Posts: 22

complete series

[ Edited ]

 

 

Hello,

I want to complete each series present in the table test1 by a value tmp

when absent relative to the var1 of the test table

 

 

 

data test;
input var1;
cards;
1
2
3
;run;

data test1;
input var1;
cards;
1
2
3
2
3
1
2
;run;

desired results

1
2
3
tmp
2
3
1
2
tmp

 

 

 

Thank you

 

Trusted Advisor
Posts: 1,312

Re: complete series

Posted in reply to mansour_ibrahim

This would be a nice homework assignment.   What have you tried so far?  If you've tried nothing, then let us now how you would logically perform the task.

Super User
Posts: 13,338

Re: complete series

Posted in reply to mansour_ibrahim

In your example the variable Var1 is numeric. As such it can never hold the value "tmp" which is character.

 

Also, what would the result be if your data looked like:

data test1;
input var1;
cards;
4
5
7
1
2
3
2
3
1
2
;run;

or

 

data test1;
input var1;
cards;
4
5
7
1
2
3
2
3
1
2
5
1
2
3
3
3
;run;

You will have to expand a bit on your definition of what a "series" is and "absent relative".

 

Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 0 likes
  • 3 in conversation