BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
In a dataset there are 250 obseravations .Now i want all the observations appended to new dataset and each observation should be repeated to 100 times.so the observations should be 25,000

ex.
data l;
input id name$;
1 temp
2 ordinary
3 general
run;

the observation temp,ordinary,general should repat 100 times and form new dataset.

output shd be
1 temp
2 ordinary
3 general
1 temp
2 ordinary
3 general
1 temp
2 ordinary
3 general
1 temp
2 ordinary
3 general
1 temp
2 ordinary
3 general
like this
2 REPLIES 2
andreas_lds
Jade | Level 19
The problem can be solved by using a do-loop containing an output-statement.

[pre]data NewData;
set OldData;
length i 8;
drop i;
do i = 1 to 100;
output;
end;
run;[/pre]
data_null__
Jade | Level 19
Using the SAS/STAT procedure SURVEYSELECT provides what is probably the simpliest solution.

[pre]
data l;
input id name$;
cards;
1 temp
2 ordinary
3 general
;;;;
run;
proc surveyselect rep=10 rate=1 out=repeated;
run;
proc print;
run;
[/pre]

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1043 views
  • 0 likes
  • 3 in conversation