BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

 

I have a question. When I run the program, for the ID=2 subject: I am getting atm and btm values in col1 and col2. Is there any better way that I can use to get both values in col1 in one step. I am doing two additional datasteps to get the output I need.  Thank you. Please suggest 

 

 

 

data one;
input id fn $ v$ atm $5. +1 btm $5.;
datalines;
1 s v1 10:00 2:00
2 s v1 10:30 3:00
2 s v1 10:00 2:00
3 s v1 10:30 3:00
;
	proc transpose data=one out=two;
  var atm btm;
  by id fn v;
run;
2 REPLIES 2
Reeza
Super User

Post exactly what you want the output to look like please.

PGStats
Opal | Level 21

Like this:

 

data one;
input id fn $ v$ atm $5. +1 btm $5.;
datalines;
1 s v1 10:00 2:00
2 s v1 10:30 3:00
2 s v1 10:00 2:00
3 s v1 10:30 3:00
;

data temp;
set one;
obs + 1;
run;
    
proc transpose data=temp out=two(drop=obs);
  var atm btm;
  by id fn v obs;
run;
PG

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

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
  • 692 views
  • 3 likes
  • 3 in conversation