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

Hello,

Basically I have a dataset where two-by-two lines are basically indentical and sort of complete each other like a puzzle piece (you'll see what I mean). And my goal is to merge those two lines to make just one. here's the set:

It shows number of men and women according to their age.

Tranche       Hommes Femmes

65 ans et plus   |   0    |   71
65 ans et plus   | 241 |    0
De 18 à 24 ans |   0    |  203
De 18 à 24 ans | 386 |    0
De 25 à 29 ans |    0   |  710
De 25 à 29 ans |1106|      0
De 30 à 34 ans |    0   |   680
De 30 à 34 ans |1380|     0

 

What i want is this:

 

65 ans et plus   |   241    |   71
De 18 à 24 ans |   386    |  203
De 25 à 29 ans |    1106 |  710
De 30 à 34 ans | 1380    |   680

 

any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
proc summary data=have;
    class tranche;
    var hommes femmes;
    output out=want sum=;
run;
--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26
proc summary data=have;
    class tranche;
    var hommes femmes;
    output out=want sum=;
run;
--
Paige Miller
polpel
Fluorite | Level 6

omg thanks!!!!!

polpel
Fluorite | Level 6

just it adds a new line with the sum of all the observations, any way of avoiding it?

i'm totally new in sas please dont judge 😞

PaigeMiller
Diamond | Level 26

Oh, that was my mistake. You can simply delete that record, or here is the fixed code

 

proc summary data=have nway;
    class tranche;
    var hommes femmes;
    output out=want sum=;
run;
--
Paige Miller
Ksharp
Super User

Paige,

You missed option NWAY .

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 347 views
  • 0 likes
  • 3 in conversation