BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Asger
Fluorite | Level 6

Hi.

 

I have a large data set with multiple lines per observation that I want to convert to one line with multiple columns.

Unfortunately, the number of lines vary from one observation to the other.

 

I cannot provide you with an example, as it contains patient sensitive information and thus runs on a closed network.

 

Does anyone have that magic piece of code, that will read a variable number of lines into on line?

 

Kind regards

Asger

1 ACCEPTED SOLUTION

Accepted Solutions
RichardDeVen
Barite | Level 11

Post a sample data set with 2 or 3 groups that you would want transformed.  Show the resultant data set after the transformation.

 

You might end up wanting to pivot the data with 

Proc TRANSPOSE; 
  by patient_id;
  ...

 

 

View solution in original post

2 REPLIES 2
RichardDeVen
Barite | Level 11

Post a sample data set with 2 or 3 groups that you would want transformed.  Show the resultant data set after the transformation.

 

You might end up wanting to pivot the data with 

Proc TRANSPOSE; 
  by patient_id;
  ...

 

 

Asger
Fluorite | Level 6

Thank you - you gave me the key word I needed. 

It is solved 🙂

 

Have a nice day!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1771 views
  • 1 like
  • 2 in conversation