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

Hello,

 

I'm hoping someone could help me with the following.

 

I have the following output table and would like the data to be in one row instead of multiple rows.

 

ABCDE
28846512....
.10942982...
..1418164..
...207.29.
....20092412

 

I want the above table to look like below:

 

ABCDE
28846512109429821418164207.2920092412

 

Value your help.

 

Kind regards,

Mags

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21
proc means data=have noprint;
var _all_;
output out=want(drop=_: ) max=;
run;
PG

View solution in original post

7 REPLIES 7
Shmuel
Garnet | Level 18

What type of input you have ? is it a sas dataset or external file (like: .txt or .xsl) ?

Is there an ID column ? How many variables are in a row ?

What do you want to do with the data ?

Why not save it all in one column ?

 

The solution depends on your answers.

Timbim
Obsidian | Level 7
Hi Shmuel,

It is a sas dataset and does not have a column ID.

Thank you .
Shmuel
Garnet | Level 18

Assuming there are 5 columns:

data want;
  set have;
        retain v1-v5;
        array  vx v1-v5;
        array inp a b c d e;
        i = mod(_N_, 5);
        vx(i) - inp(i);
       
       if i=0 then output;
      keep v1-v5;
run;
      
Timbim
Obsidian | Level 7

Thanks kindly Shmuel.

 

 

PGStats
Opal | Level 21
proc means data=have noprint;
var _all_;
output out=want(drop=_: ) max=;
run;
PG
Timbim
Obsidian | Level 7

Thank you so much PG. It works perfectly.

 

 

euro_andres
Fluorite | Level 6

Beautiful solution!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2420 views
  • 1 like
  • 4 in conversation