Desktop productivity for business analysts and programmers

Coding Question

Reply
N/A
Posts: 0

Coding Question

Hi All!!

I'm presently taking a listing of ID(account) numbers , then appending emails to this listing via db links etc.

The return I get back lists out each email individually, hence many lines with the same account #

ie: my list was originally say 2,600 records.

Now its 34,000

Is there a way I can then code to collapse the accounts to a single line and just list out the numerous emails on the same line.

Output will be a csv.


Many Thanks!
SAS Super FREQ
Posts: 8,720

Re: Coding Question

Hi:
Basically, if you have data like this:
[pre]
ID Email
110 Joyce@school.edu
110 Thomas@school.edu
120 James@school.edu
120 Jane@school.edu
120 John@school.edu
120 Louise@school.edu
120 Robert@school.edu
130 Alice@school.edu
130 Barbara@school.edu
130 Jeffrey@school.edu
140 Alfred@school.edu
140 Carol@school.edu
140 Henry@school.edu
140 Judy@school.edu
150 Janet@school.edu
150 Mary@school.edu
150 Ronald@school.edu
150 William@school.edu
160 Philip@school.edu
[/pre]

and you want to turn it into something like this:
[pre]
ID em1 em2 em3 em4 em5
110 Joyce@school.edu Thomas@school.edu
120 James@school.edu Jane@school.edu John@school.edu Louise@school.edu Robert@school.edu
130 Alice@school.edu Barbara@school.edu Jeffrey@school.edu
140 Alfred@school.edu Carol@school.edu Henry@school.edu Judy@school.edu
150 Janet@school.edu Mary@school.edu Ronald@school.edu William@school.edu
160 Philip@school.edu

[/pre]

You will want to restructure or transpose your data. Under the Tasks by Category, I believe the name of the task in EG is just TRANSPOSE. Using the above data as an example, ID would be the Group By variable and email would be the variable to transpose. On the Options pane, EM would be the value for the prefix (in order to get EM1-EM5 as the column names).

cynthia
N/A
Posts: 0

Re: Coding Question

Hi Cynthia!!

Thank you sooooo much, worked like a charm!!

Regards!
Ask a Question
Discussion stats
  • 2 replies
  • 85 views
  • 0 likes
  • 2 in conversation