Hi,
I have a dataset........."HAVE"
I want a variable in it lets say Category: and has values A, B, C, D, E, F, G.there are numerous
I want to split my HAVE data into 2: one containing "all the category values" and the other containing say for example E
data want_all want_E
set have;
if category eq E then output want_E
;
run;
is the above logic right????
since I dint write any logic for want_all does all the records go into it automatically?????
Again , do you have any better way to do it??/
Thanks
Just add an output statement. e.g.:
data want_all want_E;
set have;
output want_all;;
if category eq 'E' then output want_E;
run;
If there is a better way, I'm not aware of it.
Why don't you just test this rather than ask the question? Doesn't asking the question actually take longer?
Other than" is there a better way" you can probably test this to get your answer or read the documentation.
Hi Reeza,
I tested it before asking a question on the Community!!!
I am getting 0 records in the want_all...So I wanted to know how to get all the records into want_all.
Please don't mind.......I know asking the question takes longer but when you are stuck I think there is no other go to ask the experts ????
Thanks
Just add an output statement. e.g.:
data want_all want_E;
set have;
output want_all;;
if category eq 'E' then output want_E;
run;
If there is a better way, I'm not aware of it.
You are all of great help .
Learning SAS is a continuous process ............atleast for me
Thanks
I've been continually trying to learn it for the past 40+ years.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.