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]

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1105 views
  • 0 likes
  • 3 in conversation