BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I'm working with large datasets. With only a part of the dataset I want to do calculations. How can I filter or restrict my data set in such a manner that only the important data is included. I have columns with labels on which I can select.

e.g. a dataset:
Names dataA dataB
NameA 1 2
NameB 1 3
NameC 1 4
NameB 3 6
NameC 5 9
NameB 5 9
NameA 3 0
NameB 7 0

I want only the observations with the label NameB, thus the result must be the dataset:

Names dataA dataB
NameB 1 3
NameB 3 6
NameB 5 9
NameB 7 0

I tried some things with proc sort, but then the dataset is sorted according to the labels, but I want to exclude the data which have not the right label.

Thanks in advance,

Govert
3 REPLIES 3
advoss
Quartz | Level 8
try something like:
proc sort data=instuff out=outstuff;
by var1 var2 ...;
where names = 'NameB';
run;
deleted_user
Not applicable
I tried your suggestion yesterday night.

It works!

Thanks a lot!

govert
deleted_user
Not applicable
Try This..

proc sql noprint;
create table dataset1 as
select * from dataset
where Names eq "NameB";
quit;


Srinu
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
  • 3 replies
  • 1505 views
  • 0 likes
  • 2 in conversation