Help using Base SAS procedures

Appending data for 100 times.

Reply
Regular Contributor
Posts: 229

Appending data for 100 times.

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
Super Contributor
Posts: 345

Re: Appending data for 100 times.

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]
Respected Advisor
Posts: 3,799

Re: Appending data for 100 times.

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]
Ask a Question
Discussion stats
  • 2 replies
  • 115 views
  • 0 likes
  • 3 in conversation