/* create 19 datasets with number */ %macro creatdatasets(ds); %do i=1 %to 19 ; if _n_=i then do; data _&i.; output; %end; %mend; %put createdataset(sashelp.class);
Here i want to create 19 datasets each dataset has to be single observations using do loops macro
Is this homework?
If yes, start by having working non-macro code which creates one dataset as wanted. Post this code.
If not, I seriously question the need for splitting.
yes its homework could you please give solution
Homework is intended to test your skills, not ours. It is really time now that you start using the most important tool you were given at birth. It sits between your ears and is called a brain.
And I have already given you the path to the solution: start with working code for one output file. If, after 4 years and 600 posts here, you still cannot get that extremely simple part done, you have to face the fact that you just haven't got what it takes to work with SAS. Find another endeavor which fits your capabilities.
Why would you (or anyone) want many different data sets each with one observation, rather than one large data set with all observations? Many data sets with one observation each will be a nightmare to work with, compared to everything in one large data set.
If this is homework, then shame on your instructor for asking you to do something that likely will never be needed.
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.