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.
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.
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.