BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ammarhm
Lapis Lazuli | Level 10

Hi

A question please, i have a table containing a large number of observations, the table ( a case-control study) looks like this

Header 1Header 2Header 4
A23

43

A86T80
A8777
A78776
A485
D2322
D771
D163
D994
C655
C5556
C77
C097

what i want is to create another table that would only include the first three observations in each group in the first columns (Header 1), here is the output

Header 1Header 2Header 4
A23

43

A86T80
A485
D2322
D771
D163
C655
C5556
C77

Any help is appreciated

er of

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

A BY clause and a sum statement will do the trick :

data want;

set have; by Header1 notsorted;

if first.Header1 then order = 0;

order + 1;

if order <= 3;

drop order;

run;

PG

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

A BY clause and a sum statement will do the trick :

data want;

set have; by Header1 notsorted;

if first.Header1 then order = 0;

order + 1;

if order <= 3;

drop order;

run;

PG

PG
ammarhm
Lapis Lazuli | Level 10

Thank you PGSats

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1370 views
  • 0 likes
  • 2 in conversation