Hello,
Here is the table I have currently:
1 | 005 | 002 | 005002 | 005002001 | 19822 | 19864 | . | . |
---|---|---|---|---|---|---|---|---|
2 | 005 | 002 | 005002 | 005002001 | . | . | 19822 | 19864 |
3 | 016 | 002 | 016002 | 016002001 | 19843 | 19864 | . | . |
4 | 016 | 002 | 016002 | 016002002 | . | . | 19843 | 19843 |
5 | 017 | 002 | 017002 | 017002006 | 19820 | 19822 | . | . |
6 | 017 | 002 | 017002 | 017002006 | . | . | 19820 | 19822 |
7 | 020 | 002 | 020002 | 020002001 | 19836 | 19836 | . | . |
8 | 020 | 002 | 020002 | 020002001 | . | . | 19836 | 19836 |
9 | 021 | 002 | 021002 | 021002001 | 19824 | 19824 | . | . |
10 | 021 | 002 | 021002 | 021002001 | . | . | 19824 | 19824 |
11 | 049 | 002 | 049002 | 049002001 | 19845 | 19864 | . | . |
12 | 049 | 002 | 049002 | 049002003 | . | . | 19864 | 19864 |
I am looking for a way to basically combine two lines into one line... for example, combine obs1 with obs2, obs3 with obs4 etc. The problem is that there are missing values for the different variables. So basically I would like this table to only be 6 rows with all the information accros one straight line. Does anyone know how to do this?
Thanks!
-Tyler
Something like this?
data have;
infile cards dlm='09'x;
input v1-v9;
cards;
1 005 002 005002 005002001 19822 19864 . .
2 005 002 005002 005002001 . . 19822 19864
3 016 002 016002 016002001 19843 19864 . .
4 016 002 016002 016002002 . . 19843 19843
5 017 002 017002 017002006 19820 19822 . .
6 017 002 017002 017002006 . . 19820 19822
7 020 002 020002 020002001 19836 19836 . .
8 020 002 020002 020002001 . . 19836 19836
9 021 002 021002 021002001 19824 19824 . .
10 021 002 021002 021002001 . . 19824 19824
11 049 002 049002 049002001 19845 19864 . .
12 049 002 049002 049002003 . . 19864 19864
;
data want;
update have (obs=0) have;
by v2;
run;
Haikuo
proc stdize data=have out=want reponly method=median;
by v2;
var v6-v9;
run;
data final;
set want;
by v2;
if first.v2;
run;
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 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.