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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 7 replies
  • 1392 views
  • 1 like
  • 4 in conversation