Can anyone tell me what would be the code for creating multiple dataset from one dataset in one data step?
Example: I have the following info dataset
Name City Country
John New York USA
Albert Toronto Canada
Alice Sydney Australia
I want to create 3 dataset called USA, Canada and Australia from info dataset above. I tried the following way, but it's not working:
data usa canada australia;
set info;
if country='usa' then output usa;
if country='Canada' then output Canada;
if country='Australia' then output Australia;
run;
can anyone help please. Thanks.
Here's an article that I wrote recently:
http://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/
Be sure to read the comments, as several other experts have weighed in with improvements.
Chris
I seem to recall someone already answering this last week. One of your records shows the country as USA, but your if statement is looking for usa.
Here's the other thread:
With some of the spam activity, we've seen some people add messages more than once because messages by brand new users are moderated. We've been trying to weed out the duplicates, but some still slip through.
Chris
Consider whether you really need to split this dataset of if you are better off processing using BY or CLASS statements.
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.
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.