BookmarkSubscribeRSS Feed
tkallday33
Calcite | Level 5

Hello,

Here is the table I have currently:

10050020050020050020011982219864..
2005002005002005002001..1982219864
30160020160020160020011984319864..
4016002016002016002002..1984319843
50170020170020170020061982019822..
6017002017002017002006..1982019822
70200020200020200020011983619836..
8020002020002020002001..1983619836
90210020210020210020011982419824..
10021002021002021002001..1982419824
110490020490020490020011984519864..
12049002049002049002003..1986419864

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

2 REPLIES 2
Haikuo
Onyx | Level 15

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

stat_sas
Ammonite | Level 13

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 718 views
  • 4 likes
  • 3 in conversation