/* 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);
Hi
Here i want to create 19 datasets each dataset has to be single observations using do loops macro
And what exactly is your problem with the task?
Here i am trying to create 19 datasets each dataset should be single observarion
ex ds_1 contains name sex age height weight
.............
ds_19
Try to create one dataset with one obs without any macro-statement. Then identify the statements that need to be dynamic and start replacing.
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.
@BrahmanandaRao wrote:
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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.