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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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