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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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