sas-transpose the rows

Posted on 2012-04-02
Last Modified: 2012-04-20
I have table which looks like

wc_id email

i want the results as
wc_id email

Question by:sam2929
1 Comment
LVL 14

Accepted Solution

Aloysius Low earned 500 total points
ID: 37799183
you are not looking at transpose actually, but more of a data step processing:

data [[i]output[/i]] (drop=email rename=(new_email = email));
	set [[i]input[/i]];
	length new_email $200.;
	retain new_email;
	by wc_id;

	if first.wc_id then do;
		new_email = email;
	else do;
		new_email = trim(left(new_email)) || ";" || trim(left(email));

	if last.wc_id then output;

Open in new window

of course, you can use PROC TRANSPOSE to perform the transpose but you'll get multiple columns. then from there, you'll need further processing (even more coding than above, trust me) to get your desired results...

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL 2014 AG in-place upgrade to SQL 2016 2 75
Runtime 3044 error 14 44
Exchange 2010 Database wont mount 3 46
Documenting Data flow 4 39
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question